annotate rhodecode/tests/vcs/conf.py @ 3921:932c84e8fa92 beta

fixed #851 and #563 make-index crashes on non-ascii files
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 30 May 2013 22:37:08 +0200
parents d7488551578e
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 Unit tests configuration module for vcs.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 import os
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 import time
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 import hashlib
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 import tempfile
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 import datetime
3501
3d5f4d2f0826 fixed edge case in tests when we run them from virtualmachine and not as owner of files
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
9 import shutil
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 from utils import get_normalized_path
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 from os.path import join as jn
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
13 __all__ = (
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
14 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
15 'SCM_TESTS',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
16 )
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
17
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
18 SCM_TESTS = ['hg', 'git']
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
19 uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple())))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
20
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 THIS = os.path.abspath(os.path.dirname(__file__))
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
22
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
23 GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
24
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
25 TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp')
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
26 TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
27 jn(TEST_TMP_PATH, 'vcs-git'))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
28 TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
29 jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
30 TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
31 jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
32
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
33 HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
34 TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
35 jn(TEST_TMP_PATH, 'vcs-hg'))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
36 TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
37 jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
38 TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL',
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
39 jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
40
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
41 TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir())
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
42 TEST_REPO_PREFIX = 'vcs-test'
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
43
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
44
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
45 def get_new_dir(title):
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
46 """
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
47 Returns always new directory path.
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
48 """
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
49 name = TEST_REPO_PREFIX
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
50 if title:
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
51 name = '-'.join((name, title))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
52 hex = hashlib.sha1(str(time.time())).hexdigest()
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
53 name = '-'.join((name, hex))
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
54 path = os.path.join(TEST_DIR, name)
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
55 return get_normalized_path(path)
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
56
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 PACKAGE_DIR = os.path.abspath(os.path.join(
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 os.path.dirname(__file__), '..'))
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
60 _dest = jn(TEST_TMP_PATH, 'aconfig')
3501
3d5f4d2f0826 fixed edge case in tests when we run them from virtualmachine and not as owner of files
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
61 shutil.copy(jn(THIS, 'aconfig'), _dest)
3d5f4d2f0826 fixed edge case in tests when we run them from virtualmachine and not as owner of files
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
62 TEST_USER_CONFIG_FILE = _dest
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
63
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
64 #overide default configurations with rhodecode ones
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 3501
diff changeset
65 from rhodecode.tests import *