# HG changeset patch # User Branko Majic # Date 2018-01-31 12:57:52 # Node ID 38917ced2519e902b790aa37a6749a7c830cc764 # Parent fc33889cb798cc869b7fda43da58b68013525986 tests: fix TESTS_TMP_PATH naming diff --git a/kallithea/tests/vcs/conf.py b/kallithea/tests/vcs/conf.py --- a/kallithea/tests/vcs/conf.py +++ b/kallithea/tests/vcs/conf.py @@ -17,30 +17,29 @@ THIS = os.path.abspath(os.path.dirname(_ 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 @@ def get_new_dir(title=None): 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 @@ def get_new_dir(title=None): 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 diff --git a/kallithea/tests/vcs/test_archives.py b/kallithea/tests/vcs/test_archives.py --- a/kallithea/tests/vcs/test_archives.py +++ b/kallithea/tests/vcs/test_archives.py @@ -6,7 +6,7 @@ import tempfile 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 @@ class ArchivesTestCaseMixin(_BackendTest } 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 @@ class ArchivesTestCaseMixin(_BackendTest 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 @@ class ArchivesTestCaseMixin(_BackendTest 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 @@ class ArchivesTestCaseMixin(_BackendTest 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() diff --git a/kallithea/tests/vcs/test_git.py b/kallithea/tests/vcs/test_git.py --- a/kallithea/tests/vcs/test_git.py +++ b/kallithea/tests/vcs/test_git.py @@ -12,7 +12,7 @@ from kallithea.lib.vcs.nodes import Node 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 @@ class GitRepositoryTest(unittest.TestCas 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): diff --git a/kallithea/tests/vcs/test_hg.py b/kallithea/tests/vcs/test_hg.py --- a/kallithea/tests/vcs/test_hg.py +++ b/kallithea/tests/vcs/test_hg.py @@ -7,7 +7,7 @@ from kallithea.lib.vcs.backends.hg impor 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 @@ class MercurialRepositoryTest(unittest.T 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): diff --git a/kallithea/tests/vcs/test_utils.py b/kallithea/tests/vcs/test_utils.py --- a/kallithea/tests/vcs/test_utils.py +++ b/kallithea/tests/vcs/test_utils.py @@ -18,7 +18,7 @@ from kallithea.lib.vcs.utils import auth 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 @@ class PathsTest(unittest.TestCase): 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 @@ class PathsTest(unittest.TestCase): 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), []) diff --git a/kallithea/tests/vcs/test_vcs.py b/kallithea/tests/vcs/test_vcs.py --- a/kallithea/tests/vcs/test_vcs.py +++ b/kallithea/tests/vcs/test_vcs.py @@ -5,7 +5,7 @@ from kallithea.lib.utils2 import safe_st 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 @@ class VCSTest(unittest.TestCase): 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 @@ class VCSTest(unittest.TestCase): 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)