Changeset - 191d377abad0
[Not reviewed]
default
0 3 0
Branko Majic (branko) - 8 years ago 2018-02-07 01:35:26
branko@majic.rs
Grafted from: 72cf8ab299dd
tests: cleanup vcs aconfig setup - move setup to setup_package
3 files changed with 16 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/vcs/__init__.py
Show inline comments
 
@@ -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)
kallithea/tests/vcs/conf.py
Show inline comments
 
@@ -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 @@ __all__ = (
 
    '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 *
kallithea/tests/vcs/test_repository.py
Show inline comments
 
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
0 comments (0 inline, 0 general)