changeset 7115:0f93e00c1b13

tests: cleanup of vcs test tmp dir handling
author Branko Majic <branko@majic.rs>
date Wed, 07 Feb 2018 00:59:49 +0100
parents 4495b75e5782
children 191d377abad0
files kallithea/tests/base.py kallithea/tests/vcs/conf.py
diffstat 2 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/base.py	Wed Feb 07 00:55:35 2018 +0100
+++ b/kallithea/tests/base.py	Wed Feb 07 00:59:49 2018 +0100
@@ -57,7 +57,6 @@
 ## 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'
--- a/kallithea/tests/vcs/conf.py	Wed Feb 07 00:55:35 2018 +0100
+++ b/kallithea/tests/vcs/conf.py	Wed Feb 07 00:59:49 2018 +0100
@@ -21,20 +21,16 @@
 
 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 @@
         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 @@
     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