Mercurial > kallithea
changeset 7116:191d377abad0
tests: cleanup vcs aconfig setup - move setup to setup_package
author | Branko Majic <branko@majic.rs> |
---|---|
date | Wed, 07 Feb 2018 01:35:26 +0100 |
parents | 0f93e00c1b13 |
children | 5c9eb37bdec4 |
files | kallithea/tests/vcs/__init__.py kallithea/tests/vcs/conf.py kallithea/tests/vcs/test_repository.py |
diffstat | 3 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/vcs/__init__.py Wed Feb 07 00:59:49 2018 +0100 +++ b/kallithea/tests/vcs/__init__.py Wed Feb 07 01:35:26 2018 +0100 @@ -19,12 +19,23 @@ .. _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 @@ 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)
--- a/kallithea/tests/vcs/conf.py Wed Feb 07 00:59:49 2018 +0100 +++ b/kallithea/tests/vcs/conf.py Wed Feb 07 01:35:26 2018 +0100 @@ -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 @@ 'SCM_TESTS', ) -THIS = os.path.abspath(os.path.dirname(__file__)) def get_new_dir(title=None): """ @@ -58,9 +56,5 @@ 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 *
--- a/kallithea/tests/vcs/test_repository.py Wed Feb 07 00:59:49 2018 +0100 +++ b/kallithea/tests/vcs/test_repository.py Wed Feb 07 01:35:26 2018 +0100 @@ -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