##// END OF EJS Templates
tests: cleanup vcs aconfig setup - move setup to setup_package
Branko Majic -
r7044:191d377a default
parent child Browse files
Show More
@@ -19,12 +19,23 b' function at ``tests/__init__.py``.'
19 .. _unittest: http://pypi.python.org/pypi/unittest
19 .. _unittest: http://pypi.python.org/pypi/unittest
20
20
21 """
21 """
22
23 import os
24 import shutil
25
22 from kallithea.tests.base import TEST_HG_REPO, HG_REMOTE_REPO, TEST_GIT_REPO, GIT_REMOTE_REPO
26 from kallithea.tests.base import TEST_HG_REPO, HG_REMOTE_REPO, TEST_GIT_REPO, GIT_REMOTE_REPO
23 from kallithea.tests.vcs.utils import SCMFetcher
27 from kallithea.tests.vcs.utils import SCMFetcher
24
28
25 from kallithea.tests.base import *
29 from kallithea.tests.base import *
26
30
27
31
32 # Base directory for the VCS tests.
33 VCS_TEST_MODULE_BASE_DIR = os.path.abspath(os.path.dirname(__file__))
34
35 # Path to user configuration file used during tests.
36 TEST_USER_CONFIG_FILE = os.path.join(TESTS_TMP_PATH, 'aconfig')
37
38
28 def setup_package():
39 def setup_package():
29 """
40 """
30 Prepares whole package for tests which mainly means it would try to fetch
41 Prepares whole package for tests which mainly means it would try to fetch
@@ -48,3 +59,7 b' def setup_package():'
48 for scm, fetcher_info in fetchers.items():
59 for scm, fetcher_info in fetchers.items():
49 fetcher = SCMFetcher(**fetcher_info)
60 fetcher = SCMFetcher(**fetcher_info)
50 fetcher.setup()
61 fetcher.setup()
62
63 # Copy the test user configuration file to location where
64 # temporary test data is stored at.
65 shutil.copy(os.path.join(VCS_TEST_MODULE_BASE_DIR, 'aconfig'), TEST_USER_CONFIG_FILE)
@@ -2,7 +2,6 b''
2 Unit tests configuration module for vcs.
2 Unit tests configuration module for vcs.
3 """
3 """
4 import os
4 import os
5 import shutil
6 import uuid
5 import uuid
7
6
8 # Retrieve the necessary configuration options from the test base
7 # Retrieve the necessary configuration options from the test base
@@ -19,7 +18,6 b' from kallithea.tests.base import ('
19 'SCM_TESTS',
18 'SCM_TESTS',
20 )
19 )
21
20
22 THIS = os.path.abspath(os.path.dirname(__file__))
23
21
24 def get_new_dir(title=None):
22 def get_new_dir(title=None):
25 """
23 """
@@ -58,9 +56,5 b' def get_new_dir(title=None):'
58 return "%s-%s" % (path, hex_uuid)
56 return "%s-%s" % (path, hex_uuid)
59
57
60
58
61 _dest = os.path.join(TESTS_TMP_PATH, 'aconfig')
62 shutil.copy(os.path.join(THIS, 'aconfig'), _dest)
63 TEST_USER_CONFIG_FILE = _dest
64
65 # overide default configurations with kallithea ones
59 # overide default configurations with kallithea ones
66 from kallithea.tests.base import *
60 from kallithea.tests.base import *
@@ -1,7 +1,7 b''
1 import datetime
1 import datetime
2 from kallithea.tests.vcs.base import _BackendTestMixin
2 from kallithea.tests.vcs.base import _BackendTestMixin
3 from kallithea.tests.vcs.conf import SCM_TESTS
3 from kallithea.tests.vcs.conf import SCM_TESTS
4 from kallithea.tests.vcs.conf import TEST_USER_CONFIG_FILE
4 from kallithea.tests.vcs import TEST_USER_CONFIG_FILE
5 from kallithea.lib.vcs.nodes import FileNode
5 from kallithea.lib.vcs.nodes import FileNode
6 from kallithea.lib.vcs.utils.compat import unittest
6 from kallithea.lib.vcs.utils.compat import unittest
7 from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError
7 from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError
General Comments 0
You need to be logged in to leave comments. Login now