diff --git a/kallithea/tests/vcs/__init__.py b/kallithea/tests/vcs/__init__.py --- a/kallithea/tests/vcs/__init__.py +++ b/kallithea/tests/vcs/__init__.py @@ -19,12 +19,23 @@ function at ``tests/__init__.py``. .. _unittest: http://pypi.python.org/pypi/unittest """ + +import os +import shutil + from kallithea.tests.base import TEST_HG_REPO, HG_REMOTE_REPO, TEST_GIT_REPO, GIT_REMOTE_REPO from kallithea.tests.vcs.utils import SCMFetcher from kallithea.tests.base import * +# Base directory for the VCS tests. +VCS_TEST_MODULE_BASE_DIR = os.path.abspath(os.path.dirname(__file__)) + +# Path to user configuration file used during tests. +TEST_USER_CONFIG_FILE = os.path.join(TESTS_TMP_PATH, 'aconfig') + + def setup_package(): """ Prepares whole package for tests which mainly means it would try to fetch @@ -48,3 +59,7 @@ def setup_package(): for scm, fetcher_info in fetchers.items(): fetcher = SCMFetcher(**fetcher_info) fetcher.setup() + + # Copy the test user configuration file to location where + # temporary test data is stored at. + shutil.copy(os.path.join(VCS_TEST_MODULE_BASE_DIR, 'aconfig'), TEST_USER_CONFIG_FILE) diff --git a/kallithea/tests/vcs/conf.py b/kallithea/tests/vcs/conf.py --- a/kallithea/tests/vcs/conf.py +++ b/kallithea/tests/vcs/conf.py @@ -2,7 +2,6 @@ Unit tests configuration module for vcs. """ import os -import shutil import uuid # Retrieve the necessary configuration options from the test base @@ -19,7 +18,6 @@ from kallithea.tests.base import ( 'SCM_TESTS', ) -THIS = os.path.abspath(os.path.dirname(__file__)) def get_new_dir(title=None): """ @@ -58,9 +56,5 @@ def get_new_dir(title=None): return "%s-%s" % (path, hex_uuid) -_dest = os.path.join(TESTS_TMP_PATH, 'aconfig') -shutil.copy(os.path.join(THIS, 'aconfig'), _dest) -TEST_USER_CONFIG_FILE = _dest - # overide default configurations with kallithea ones from kallithea.tests.base import * diff --git a/kallithea/tests/vcs/test_repository.py b/kallithea/tests/vcs/test_repository.py --- a/kallithea/tests/vcs/test_repository.py +++ b/kallithea/tests/vcs/test_repository.py @@ -1,7 +1,7 @@ import datetime from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS -from kallithea.tests.vcs.conf import TEST_USER_CONFIG_FILE +from kallithea.tests.vcs import TEST_USER_CONFIG_FILE from kallithea.lib.vcs.nodes import FileNode from kallithea.lib.vcs.utils.compat import unittest from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError