Mercurial > kallithea
diff rhodecode/tests/vcs/conf.py @ 3797:d7488551578e beta
synced vcs with upstream
- moved subprocessio module to VCS
- many small changes to make embedded vcs as similar to to external lib
- use only absolute imports
- patch vcs config during load pylons env
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 27 Apr 2013 11:24:25 +0200 |
parents | 3d5f4d2f0826 |
children | 7e5f8c12a3fc |
line wrap: on
line diff
--- a/rhodecode/tests/vcs/conf.py Sat Apr 27 11:45:27 2013 +0200 +++ b/rhodecode/tests/vcs/conf.py Sat Apr 27 11:24:25 2013 +0200 @@ -1,64 +1,65 @@ """ Unit tests configuration module for vcs. """ - import os import time import hashlib import tempfile import datetime import shutil -from rhodecode.tests import * from utils import get_normalized_path from os.path import join as jn -TEST_TMP_PATH = TESTS_TMP_PATH -#__all__ = ( -# 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', -# 'SCM_TESTS', -#) -# -#SCM_TESTS = ['hg', 'git'] -#uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) -# +__all__ = ( + 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', + 'SCM_TESTS', +) + +SCM_TESTS = ['hg', 'git'] +uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) + THIS = os.path.abspath(os.path.dirname(__file__)) -# -#GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' -# -#TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp') -#TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO', -# jn(TEST_TMP_PATH, 'vcs-git')) -#TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE', -# jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)) -#TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL', -# jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)) -# -#HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' -#TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO', -# jn(TEST_TMP_PATH, 'vcs-hg')) -#TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE', -# jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix)) -#TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL', -# jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix)) -# -#TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir()) -#TEST_REPO_PREFIX = 'vcs-test' -# -# -#def get_new_dir(title): -# """ -# Returns always new directory path. -# """ -# name = TEST_REPO_PREFIX -# if title: -# name = '-'.join((name, title)) -# hex = hashlib.sha1(str(time.time())).hexdigest() -# name = '-'.join((name, hex)) -# path = os.path.join(TEST_DIR, name) -# return get_normalized_path(path) + +GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' + +TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp') +TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO', + jn(TEST_TMP_PATH, 'vcs-git')) +TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE', + jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)) +TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL', + jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)) + +HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' +TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO', + jn(TEST_TMP_PATH, 'vcs-hg')) +TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE', + jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix)) +TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL', + jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix)) + +TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir()) +TEST_REPO_PREFIX = 'vcs-test' + + +def get_new_dir(title): + """ + Returns always new directory path. + """ + name = TEST_REPO_PREFIX + if title: + name = '-'.join((name, title)) + hex = hashlib.sha1(str(time.time())).hexdigest() + name = '-'.join((name, hex)) + path = os.path.join(TEST_DIR, name) + return get_normalized_path(path) + PACKAGE_DIR = os.path.abspath(os.path.join( os.path.dirname(__file__), '..')) -_dest = jn(TESTS_TMP_PATH,'aconfig') +_dest = jn(TEST_TMP_PATH, 'aconfig') shutil.copy(jn(THIS, 'aconfig'), _dest) TEST_USER_CONFIG_FILE = _dest + +#overide default configurations with rhodecode ones +from rhodecode.tests import *