changeset 7114:4495b75e5782

tests: cleanup of definition of test constants - we don't care about keeping vcs self-contained
author Branko Majic <branko@majic.rs>
date Wed, 07 Feb 2018 00:55:35 +0100
parents 38917ced2519
children 0f93e00c1b13
files kallithea/tests/base.py kallithea/tests/vcs/__init__.py kallithea/tests/vcs/conf.py
diffstat 3 files changed, 23 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/base.py	Wed Jan 31 13:57:52 2018 +0100
+++ b/kallithea/tests/base.py	Wed Feb 07 00:55:35 2018 +0100
@@ -88,23 +88,25 @@
 SCM_TESTS = ['hg', 'git']
 uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple())))
 
-GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
+GIT_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO)
 
 TEST_GIT_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO)
-TEST_GIT_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)
-TEST_GIT_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)
+TEST_GIT_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcs-git-clone-%s' % uniq_suffix)
+TEST_GIT_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcs-git-pull-%s' % uniq_suffix)
 
-
-HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
+HG_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO)
 
 TEST_HG_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO)
-TEST_HG_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcshgclone%s' % uniq_suffix)
-TEST_HG_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcshgpull%s' % uniq_suffix)
+TEST_HG_REPO_CLONE = os.path.join(TESTS_TMP_PATH, 'vcs-hg-clone-%s' % uniq_suffix)
+TEST_HG_REPO_PULL = os.path.join(TESTS_TMP_PATH, 'vcs-hg-pull-%s' % uniq_suffix)
 
-# cached repos if any !
-# comment out to get some other repos from bb or github
-GIT_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO)
-HG_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO)
+# By default, some of the tests will utilise locally available
+# repositories stored within tar.gz archives as source for
+# cloning. Should you wish to use some other, remote archive, simply
+# uncomment these entries and/or update the URLs to use.
+#
+# GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
+# HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
 
 # skip ldap tests if LDAP lib is not installed
 ldap_lib_installed = False
--- a/kallithea/tests/vcs/__init__.py	Wed Jan 31 13:57:52 2018 +0100
+++ b/kallithea/tests/vcs/__init__.py	Wed Feb 07 00:55:35 2018 +0100
@@ -19,7 +19,7 @@
 .. _unittest: http://pypi.python.org/pypi/unittest
 
 """
-from kallithea.tests.vcs.conf import *
+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 *
--- a/kallithea/tests/vcs/conf.py	Wed Jan 31 13:57:52 2018 +0100
+++ b/kallithea/tests/vcs/conf.py	Wed Feb 07 00:55:35 2018 +0100
@@ -2,38 +2,25 @@
 Unit tests configuration module for vcs.
 """
 import os
-import tempfile
 import shutil
 import uuid
 
+# Retrieve the necessary configuration options from the test base
+# module. Some of these configuration options are subsequently
+# consumed by the VCS test module.
+from kallithea.tests.base import (
+    TESTS_TMP_PATH, SCM_TESTS,
+    TEST_HG_REPO, HG_REMOTE_REPO,
+    TEST_GIT_REPO, GIT_REMOTE_REPO,
+)
+
 __all__ = (
     'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO',
     'SCM_TESTS',
 )
 
-SCM_TESTS = ['hg', 'git']
-
 THIS = os.path.abspath(os.path.dirname(__file__))
 
-GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
-
-TESTS_TMP_PATH = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir())
-
-TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO',
-                               os.path.join(TESTS_TMP_PATH, 'vcs-git'))
-TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_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(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(TESTS_TMP_PATH, 'vcs-hg'))
-TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_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(TESTS_TMP_PATH, 'vcs-hg-pull'))
-
 TEST_REPO_PREFIX = 'vcs-test'