changeset 7113:38917ced2519

tests: fix TESTS_TMP_PATH naming
author Branko Majic <branko@majic.rs>
date Wed, 31 Jan 2018 13:57:52 +0100
parents fc33889cb798
children 4495b75e5782
files kallithea/tests/vcs/conf.py kallithea/tests/vcs/test_archives.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_hg.py kallithea/tests/vcs/test_utils.py kallithea/tests/vcs/test_vcs.py
diffstat 6 files changed, 27 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/vcs/conf.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/conf.py	Wed Jan 31 13:57:52 2018 +0100
@@ -17,30 +17,29 @@
 
 GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
 
-# Note: TEST_TMP_PATH, not TESTS_TMP_PATH
-TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir())
+TESTS_TMP_PATH = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir())
 
 TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO',
-                               os.path.join(TEST_TMP_PATH, 'vcs-git'))
+                               os.path.join(TESTS_TMP_PATH, 'vcs-git'))
 TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE',
-                                     os.path.join(TEST_TMP_PATH, 'vcs-git-clone'))
+                                     os.path.join(TESTS_TMP_PATH, 'vcs-git-clone'))
 TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL',
-                                    os.path.join(TEST_TMP_PATH, 'vcs-git-pull'))
+                                    os.path.join(TESTS_TMP_PATH, 'vcs-git-pull'))
 
 HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
 TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO',
-                              os.path.join(TEST_TMP_PATH, 'vcs-hg'))
+                              os.path.join(TESTS_TMP_PATH, 'vcs-hg'))
 TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE',
-                                    os.path.join(TEST_TMP_PATH, 'vcs-hg-clone'))
+                                    os.path.join(TESTS_TMP_PATH, 'vcs-hg-clone'))
 TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL',
-                                   os.path.join(TEST_TMP_PATH, 'vcs-hg-pull'))
+                                   os.path.join(TESTS_TMP_PATH, 'vcs-hg-pull'))
 
 TEST_REPO_PREFIX = 'vcs-test'
 
 
 def get_new_dir(title=None):
     """
-    Calculates a path for a new, non-existant, unique sub-directory in TEST_TMP_PATH.
+    Calculates a path for a new, non-existant, unique sub-directory in TESTS_TMP_PATH.
 
     Resulting directory name will have format:
 
@@ -64,7 +63,7 @@
     else:
         name = TEST_REPO_PREFIX
 
-    path = os.path.join(TEST_TMP_PATH, name)
+    path = os.path.join(TESTS_TMP_PATH, name)
 
     # Generate new hexes until we get a unique name (just in case).
     hex_uuid = uuid.uuid4().hex
@@ -76,7 +75,7 @@
 
 PACKAGE_DIR = os.path.abspath(os.path.join(
     os.path.dirname(__file__), '..'))
-_dest = os.path.join(TEST_TMP_PATH, 'aconfig')
+_dest = os.path.join(TESTS_TMP_PATH, 'aconfig')
 shutil.copy(os.path.join(THIS, 'aconfig'), _dest)
 TEST_USER_CONFIG_FILE = _dest
 
--- a/kallithea/tests/vcs/test_archives.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/test_archives.py	Wed Jan 31 13:57:52 2018 +0100
@@ -6,7 +6,7 @@
 import StringIO
 
 from kallithea.tests.vcs.base import _BackendTestMixin
-from kallithea.tests.vcs.conf import SCM_TESTS, TEST_TMP_PATH
+from kallithea.tests.vcs.conf import SCM_TESTS, TESTS_TMP_PATH
 from kallithea.lib.vcs.exceptions import VCSError
 from kallithea.lib.vcs.nodes import FileNode
 from kallithea.lib.vcs.utils.compat import unittest
@@ -29,7 +29,7 @@
             }
 
     def test_archive_zip(self):
-        path = tempfile.mkstemp(dir=TEST_TMP_PATH, prefix='test_archive_zip-')[1]
+        path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_zip-')[1]
         with open(path, 'wb') as f:
             self.tip.fill_archive(stream=f, kind='zip', prefix='repo')
         out = zipfile.ZipFile(path)
@@ -43,10 +43,10 @@
                 self.tip.get_node(node_path).content)
 
     def test_archive_tgz(self):
-        path = tempfile.mkstemp(dir=TEST_TMP_PATH, prefix='test_archive_tgz-')[1]
+        path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_tgz-')[1]
         with open(path, 'wb') as f:
             self.tip.fill_archive(stream=f, kind='tgz', prefix='repo')
-        outdir = tempfile.mkdtemp(dir=TEST_TMP_PATH, prefix='test_archive_tgz-', suffix='-outdir')
+        outdir = tempfile.mkdtemp(dir=TESTS_TMP_PATH, prefix='test_archive_tgz-', suffix='-outdir')
 
         outfile = tarfile.open(path, 'r|gz')
         outfile.extractall(outdir)
@@ -58,10 +58,10 @@
                 self.tip.get_node(node_path).content)
 
     def test_archive_tbz2(self):
-        path = tempfile.mkstemp(dir=TEST_TMP_PATH, prefix='test_archive_tbz2-')[1]
+        path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_tbz2-')[1]
         with open(path, 'w+b') as f:
             self.tip.fill_archive(stream=f, kind='tbz2', prefix='repo')
-        outdir = tempfile.mkdtemp(dir=TEST_TMP_PATH, prefix='test_archive_tbz2-', suffix='-outdir')
+        outdir = tempfile.mkdtemp(dir=TESTS_TMP_PATH, prefix='test_archive_tbz2-', suffix='-outdir')
 
         outfile = tarfile.open(path, 'r|bz2')
         outfile.extractall(outdir)
@@ -73,7 +73,7 @@
                 self.tip.get_node(node_path).content)
 
     def test_archive_default_stream(self):
-        tmppath = tempfile.mkstemp(dir=TEST_TMP_PATH, prefix='test_archive_default_stream-')[1]
+        tmppath = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_default_stream-')[1]
         with open(tmppath, 'wb') as stream:
             self.tip.fill_archive(stream=stream)
         mystream = StringIO.StringIO()
--- a/kallithea/tests/vcs/test_git.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/test_git.py	Wed Jan 31 13:57:52 2018 +0100
@@ -12,7 +12,7 @@
 from kallithea.lib.vcs.utils.compat import unittest
 from kallithea.model.scm import ScmModel
 from kallithea.tests.vcs.base import _BackendTestMixin
-from kallithea.tests.vcs.conf import TEST_GIT_REPO, TEST_GIT_REPO_CLONE, TEST_TMP_PATH, get_new_dir
+from kallithea.tests.vcs.conf import TEST_GIT_REPO, TEST_GIT_REPO_CLONE, TESTS_TMP_PATH, get_new_dir
 
 
 class GitRepositoryTest(unittest.TestCase):
@@ -27,7 +27,7 @@
         self.repo = GitRepository(TEST_GIT_REPO)
 
     def test_wrong_repo_path(self):
-        wrong_repo_path = os.path.join(TEST_TMP_PATH, 'errorrepo')
+        wrong_repo_path = os.path.join(TESTS_TMP_PATH, 'errorrepo')
         self.assertRaises(RepositoryError, GitRepository, wrong_repo_path)
 
     def test_git_cmd_injection(self):
--- a/kallithea/tests/vcs/test_hg.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/test_hg.py	Wed Jan 31 13:57:52 2018 +0100
@@ -7,7 +7,7 @@
 from kallithea.lib.vcs.exceptions import RepositoryError, VCSError, NodeDoesNotExistError
 from kallithea.lib.vcs.nodes import NodeKind, NodeState
 from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_HG_REPO_CLONE, \
-    TEST_HG_REPO_PULL, TEST_TMP_PATH
+    TEST_HG_REPO_PULL, TESTS_TMP_PATH
 from kallithea.lib.vcs.utils.compat import unittest
 
 
@@ -23,7 +23,7 @@
         self.repo = MercurialRepository(safe_str(TEST_HG_REPO))
 
     def test_wrong_repo_path(self):
-        wrong_repo_path = os.path.join(TEST_TMP_PATH, 'errorrepo')
+        wrong_repo_path = os.path.join(TESTS_TMP_PATH, 'errorrepo')
         self.assertRaises(RepositoryError, MercurialRepository, wrong_repo_path)
 
     def test_unicode_path_repo(self):
--- a/kallithea/tests/vcs/test_utils.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/test_utils.py	Wed Jan 31 13:57:52 2018 +0100
@@ -18,7 +18,7 @@
 from kallithea.lib.vcs.utils.paths import get_user_home
 from kallithea.lib.vcs.exceptions import VCSError
 
-from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TEST_TMP_PATH
+from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TESTS_TMP_PATH
 
 
 class PathsTest(unittest.TestCase):
@@ -48,7 +48,7 @@
         self.assertEqual(('git', TEST_GIT_REPO), get_scm(TEST_GIT_REPO))
 
     def test_get_two_scms_for_path(self):
-        multialias_repo_path = os.path.join(TEST_TMP_PATH, 'hg-git-repo-2')
+        multialias_repo_path = os.path.join(TESTS_TMP_PATH, 'hg-git-repo-2')
         if os.path.isdir(multialias_repo_path):
             shutil.rmtree(multialias_repo_path)
 
@@ -60,7 +60,7 @@
         self.assertRaises(VCSError, get_scm, 'err')
 
     def test_get_scms_for_path(self):
-        new = os.path.join(TEST_TMP_PATH, 'vcs-scms-for-path-%s' % time.time())
+        new = os.path.join(TESTS_TMP_PATH, 'vcs-scms-for-path-%s' % time.time())
         os.mkdir(new)
         self.assertEqual(get_scms_for_path(new), [])
 
--- a/kallithea/tests/vcs/test_vcs.py	Sat Feb 10 17:06:00 2018 +0100
+++ b/kallithea/tests/vcs/test_vcs.py	Wed Jan 31 13:57:52 2018 +0100
@@ -5,7 +5,7 @@
 from kallithea.lib.vcs import VCSError, get_repo, get_backend
 from kallithea.lib.vcs.backends.hg import MercurialRepository
 from kallithea.lib.vcs.utils.compat import unittest
-from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TEST_TMP_PATH
+from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TESTS_TMP_PATH
 
 
 class VCSTest(unittest.TestCase):
@@ -63,7 +63,7 @@
         self.assertEqual(repo.path, get_repo(safe_str(path)).path)
 
     def test_get_repo_err(self):
-        blank_repo_path = os.path.join(TEST_TMP_PATH, 'blank-error-repo')
+        blank_repo_path = os.path.join(TESTS_TMP_PATH, 'blank-error-repo')
         if os.path.isdir(blank_repo_path):
             shutil.rmtree(blank_repo_path)
 
@@ -72,7 +72,7 @@
         self.assertRaises(VCSError, get_repo, blank_repo_path + 'non_existing')
 
     def test_get_repo_multialias(self):
-        multialias_repo_path = os.path.join(TEST_TMP_PATH, 'hg-git-repo')
+        multialias_repo_path = os.path.join(TESTS_TMP_PATH, 'hg-git-repo')
         if os.path.isdir(multialias_repo_path):
             shutil.rmtree(multialias_repo_path)