Mercurial > kallithea
comparison rhodecode/tests/vcs/conf.py @ 2451:402a96fcfa22 beta
Added vcs testsuite for better integration tests + added fetching
of two new repos into test env for rhodecode
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 13 Jun 2012 23:27:33 +0200 |
parents | |
children | 9492ab68331f |
comparison
equal
deleted
inserted
replaced
2450:26193dba1f0e | 2451:402a96fcfa22 |
---|---|
1 """ | |
2 Unit tests configuration module for vcs. | |
3 """ | |
4 import os | |
5 import time | |
6 import hashlib | |
7 import tempfile | |
8 import datetime | |
9 | |
10 from utils import get_normalized_path | |
11 from os.path import join as jn | |
12 | |
13 __all__ = ( | |
14 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', | |
15 'SCM_TESTS', | |
16 ) | |
17 | |
18 SCM_TESTS = ['hg', 'git'] | |
19 uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple()))) | |
20 | |
21 THIS = os.path.abspath(os.path.dirname(__file__)) | |
22 | |
23 GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git' | |
24 | |
25 TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp') | |
26 TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO', | |
27 jn(TEST_TMP_PATH, 'vcs-git')) | |
28 TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE', | |
29 jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix)) | |
30 TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL', | |
31 jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix)) | |
32 | |
33 HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs' | |
34 TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO', | |
35 jn(TEST_TMP_PATH, 'vcs-hg')) | |
36 TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE', | |
37 jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix)) | |
38 TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL', | |
39 jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix)) | |
40 | |
41 TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir()) | |
42 TEST_REPO_PREFIX = 'vcs-test' | |
43 | |
44 | |
45 def get_new_dir(title): | |
46 """ | |
47 Returns always new directory path. | |
48 """ | |
49 name = TEST_REPO_PREFIX | |
50 if title: | |
51 name = '-'.join((name, title)) | |
52 hex = hashlib.sha1(str(time.time())).hexdigest() | |
53 name = '-'.join((name, hex)) | |
54 path = os.path.join(TEST_DIR, name) | |
55 return get_normalized_path(path) | |
56 | |
57 | |
58 PACKAGE_DIR = os.path.abspath(os.path.join( | |
59 os.path.dirname(__file__), '..')) | |
60 | |
61 TEST_USER_CONFIG_FILE = jn(THIS, 'aconfig') |