comparison tests/run.py @ 613:58f397523604

testrunner: delay and `simplify' importing of tests
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 14 May 2010 20:26:06 +0200
parents 300b917d23c5
children 4f6017ba4d3d
comparison
equal deleted inserted replaced
612:2c15e4c50a54 613:58f397523604
1 import optparse 1 import optparse
2 import os 2 import os
3 import sys 3 import sys
4 import unittest 4 import unittest
5 5
6 import test_util 6 def tests():
7 import test_binaryfiles 7 import test_util
8 import test_diff 8 import test_binaryfiles
9 import test_externals 9 import test_diff
10 import test_fetch_branches 10 import test_externals
11 import test_fetch_command 11 import test_fetch_branches
12 import test_fetch_command_regexes 12 import test_fetch_command
13 import test_fetch_exec 13 import test_fetch_command_regexes
14 import test_fetch_mappings 14 import test_fetch_exec
15 import test_fetch_renames 15 import test_fetch_mappings
16 import test_fetch_symlinks 16 import test_fetch_renames
17 import test_fetch_truncated 17 import test_fetch_symlinks
18 import test_pull 18 import test_fetch_truncated
19 import test_push_command 19 import test_pull
20 import test_push_renames 20 import test_push_command
21 import test_push_dirs 21 import test_push_renames
22 import test_push_eol 22 import test_push_dirs
23 import test_rebuildmeta 23 import test_push_eol
24 import test_single_dir_clone 24 import test_rebuildmeta
25 import test_svnwrap 25 import test_single_dir_clone
26 import test_tags 26 import test_svnwrap
27 import test_utility_commands 27 import test_tags
28 import test_urls 28 import test_utility_commands
29 import test_urls
29 30
30 sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive')) 31 sys.path.append(os.path.dirname(__file__))
32 sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive'))
31 33
32 import test_stupid_pull 34 import test_stupid_pull
33 import test_verify 35 import test_verify
36
37 return locals()
34 38
35 def comprehensive(mod): 39 def comprehensive(mod):
36 dir = os.path.basename(os.path.dirname(mod.__file__)) 40 dir = os.path.basename(os.path.dirname(mod.__file__))
37 return dir == 'comprehensive' 41 return dir == 'comprehensive'
38 42
56 testargs = {'descriptions': 2} 60 testargs = {'descriptions': 2}
57 61
58 # silence output when running outside nose 62 # silence output when running outside nose
59 sys.stdout = os.tmpfile() 63 sys.stdout = os.tmpfile()
60 64
61 all = globals() 65 all = tests()
62 all = dict((k, v) for (k, v) in all.iteritems() if k.startswith('test_'))
63 del all['test_util'] 66 del all['test_util']
64 67
65 args = [i.split('.py')[0].replace('-', '_') for i in args] 68 args = [i.split('.py')[0].replace('-', '_') for i in args]
66 69
67 if not args: 70 if not args: