annotate rhodecode/tests/vcs/conf.py @ 3501:3d5f4d2f0826 beta

fixed edge case in tests when we run them from virtualmachine and not as owner of files
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 07 Mar 2013 20:06:25 +0100
parents 9492ab68331f
children d7488551578e
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 """
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
4
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 import os
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 import time
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 import hashlib
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 import tempfile
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 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
10 import shutil
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
11 from rhodecode.tests import *
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 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
13 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
14
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
15 TEST_TMP_PATH = TESTS_TMP_PATH
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
16 #__all__ = (
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
17 # 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
18 # 'SCM_TESTS',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
19 #)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
20 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
21 #SCM_TESTS = ['hg', 'git']
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
22 #uniq_suffix = str(int(time.mktime(datetime.datetime.now().timetuple())))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
23 #
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 THIS = os.path.abspath(os.path.dirname(__file__))
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
25 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
26 #GIT_REMOTE_REPO = 'git://github.com/codeinn/vcs.git'
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
27 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
28 #TEST_TMP_PATH = os.environ.get('VCS_TEST_ROOT', '/tmp')
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
29 #TEST_GIT_REPO = os.environ.get('VCS_TEST_GIT_REPO',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
30 # jn(TEST_TMP_PATH, 'vcs-git'))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
31 #TEST_GIT_REPO_CLONE = os.environ.get('VCS_TEST_GIT_REPO_CLONE',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
32 # jn(TEST_TMP_PATH, 'vcsgitclone%s' % uniq_suffix))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
33 #TEST_GIT_REPO_PULL = os.environ.get('VCS_TEST_GIT_REPO_PULL',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
34 # jn(TEST_TMP_PATH, 'vcsgitpull%s' % uniq_suffix))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
35 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
36 #HG_REMOTE_REPO = 'http://bitbucket.org/marcinkuzminski/vcs'
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
37 #TEST_HG_REPO = os.environ.get('VCS_TEST_HG_REPO',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
38 # jn(TEST_TMP_PATH, 'vcs-hg'))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
39 #TEST_HG_REPO_CLONE = os.environ.get('VCS_TEST_HG_REPO_CLONE',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
40 # jn(TEST_TMP_PATH, 'vcshgclone%s' % uniq_suffix))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
41 #TEST_HG_REPO_PULL = os.environ.get('VCS_TEST_HG_REPO_PULL',
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
42 # jn(TEST_TMP_PATH, 'vcshgpull%s' % uniq_suffix))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
43 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
44 #TEST_DIR = os.environ.get('VCS_TEST_ROOT', tempfile.gettempdir())
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
45 #TEST_REPO_PREFIX = 'vcs-test'
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
46 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
47 #
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
48 #def get_new_dir(title):
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
49 # """
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
50 # Returns always new directory path.
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
51 # """
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
52 # name = TEST_REPO_PREFIX
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
53 # if title:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
54 # name = '-'.join((name, title))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
55 # hex = hashlib.sha1(str(time.time())).hexdigest()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
56 # name = '-'.join((name, hex))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
57 # path = os.path.join(TEST_DIR, name)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
58 # return get_normalized_path(path)
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 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
61 os.path.dirname(__file__), '..'))
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
62 _dest = jn(TESTS_TMP_PATH,'aconfig')
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
63 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
64 TEST_USER_CONFIG_FILE = _dest