Changeset - 0f93e00c1b13
[Not reviewed]
default
0 2 0
Branko Majic (branko) - 8 years ago 2018-02-07 00:59:49
branko@majic.rs
Grafted from: 72cf8ab299dd
tests: cleanup of vcs test tmp dir handling
2 files changed with 7 insertions and 12 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/base.py
Show inline comments
 
@@ -57,7 +57,6 @@ __all__ = [
 
## SOME GLOBALS FOR TESTS
 

	
 
TESTS_TMP_PATH = os.environ.get('KALLITHEA_TESTS_TMP_PATH', tempfile.mkdtemp(prefix='kallithea-test-'))
 
os.environ['VCS_TEST_ROOT'] = TESTS_TMP_PATH
 

	
 
TEST_USER_ADMIN_LOGIN = 'test_admin'
 
TEST_USER_ADMIN_PASS = 'test12'
kallithea/tests/vcs/conf.py
Show inline comments
 
@@ -21,20 +21,16 @@ __all__ = (
 

	
 
THIS = os.path.abspath(os.path.dirname(__file__))
 

	
 
TEST_REPO_PREFIX = 'vcs-test'
 

	
 

	
 
def get_new_dir(title=None):
 
    """
 
    Calculates a path for a new, non-existant, unique sub-directory in TESTS_TMP_PATH.
 

	
 
    Resulting directory name will have format:
 

	
 
    prefix-[title-]hexuuid
 
    vcs-test-[title-]hexuuid
 

	
 
    Prefix is equal to value of variable TEST_REPO_PREFIX. The "hexuuid" is a
 
    hexadecimal value of a randomly generated UUID. Title will be added if
 
    specified.
 
    The "hexuuid" is a hexadecimal value of a randomly generated
 
    UUID. Title will be added if specified.
 

	
 
    Args:
 
        title: Custom title to include as part of the resulting sub-directory
 
@@ -45,10 +41,12 @@ def get_new_dir(title=None):
 
        Path to the new directory as a string.
 
    """
 

	
 
    test_repo_prefix = 'vcs-test'
 

	
 
    if title:
 
        name = "%s-%s" % (TEST_REPO_PREFIX, title)
 
        name = "%s-%s" % (test_repo_prefix, title)
 
    else:
 
        name = TEST_REPO_PREFIX
 
        name = test_repo_prefix
 

	
 
    path = os.path.join(TESTS_TMP_PATH, name)
 

	
 
@@ -60,8 +58,6 @@ def get_new_dir(title=None):
 
    return "%s-%s" % (path, hex_uuid)
 

	
 

	
 
PACKAGE_DIR = os.path.abspath(os.path.join(
 
    os.path.dirname(__file__), '..'))
 
_dest = os.path.join(TESTS_TMP_PATH, 'aconfig')
 
shutil.copy(os.path.join(THIS, 'aconfig'), _dest)
 
TEST_USER_CONFIG_FILE = _dest
0 comments (0 inline, 0 general)