comparison tests/run.py @ 1106:5cb6c95e0283 stable

Merge default and stable so I can do stable releases again.
author Augie Fackler <raf@durin42.com>
date Tue, 11 Feb 2014 12:48:49 -0500
parents 025de18d652b
children 4217a050a088
comparison
equal deleted inserted replaced
1020:b5b1fce26f1f 1106:5cb6c95e0283
1 #!/usr/bin/env python
2
1 import optparse 3 import optparse
2 import os 4 import os
3 import sys 5 import sys
4 import unittest 6 import unittest
5 7
17 import test_fetch_mappings 19 import test_fetch_mappings
18 import test_fetch_renames 20 import test_fetch_renames
19 import test_fetch_symlinks 21 import test_fetch_symlinks
20 import test_fetch_truncated 22 import test_fetch_truncated
21 import test_hooks 23 import test_hooks
24 import test_svn_pre_commit_hooks
22 import test_pull 25 import test_pull
23 import test_pull_fallback 26 import test_pull_fallback
24 import test_push_command 27 import test_push_command
25 import test_push_renames 28 import test_push_renames
26 import test_push_dirs 29 import test_push_dirs
27 import test_push_eol 30 import test_push_eol
28 import test_push_autoprops 31 import test_push_autoprops
29 import test_rebuildmeta
30 import test_single_dir_clone 32 import test_single_dir_clone
33 import test_single_dir_push
31 import test_svnwrap 34 import test_svnwrap
32 import test_tags 35 import test_tags
33 import test_template_keywords 36 import test_template_keywords
34 import test_utility_commands 37 import test_utility_commands
35 import test_unaffected_core 38 import test_unaffected_core
36 import test_updatemeta
37 import test_urls 39 import test_urls
38 40
39 sys.path.append(os.path.dirname(__file__)) 41 sys.path.append(os.path.dirname(__file__))
40 sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive')) 42 sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive'))
41 43
44 import test_rebuildmeta
42 import test_stupid_pull 45 import test_stupid_pull
46 import test_updatemeta
43 import test_verify_and_startrev 47 import test_verify_and_startrev
44 48
45 return locals() 49 return locals()
46 50
47 def comprehensive(mod): 51 def comprehensive(mod):
98 102
99 all_tests = tests() 103 all_tests = tests()
100 104
101 args = [i.split('.py')[0].replace('-', '_') for i in args] 105 args = [i.split('.py')[0].replace('-', '_') for i in args]
102 106
107 loader = unittest.TestLoader()
108 suite = unittest.TestSuite()
109
103 if not args: 110 if not args:
104 check = lambda x: options.comprehensive or not comprehensive(x) 111 check = lambda x: options.comprehensive or not comprehensive(x)
105 mods = [m for (n, m) in sorted(all_tests.iteritems()) if check(m)] 112 suite.addTests(loader.loadTestsFromModule(m)
106 suite = [m.suite() for m in mods] 113 for (n, m) in sorted(all_tests.iteritems())
114 if check(m))
107 else: 115 else:
108 suite = []
109 for arg in args: 116 for arg in args:
110 if arg == 'test_util': 117 if arg == 'test_util':
111 continue 118 continue
112 elif arg not in all_tests: 119 elif arg not in all_tests:
113 print >> sys.stderr, 'test module %s not available' % arg 120 print >> sys.stderr, 'test module %s not available' % arg
114 else: 121 else:
115 suite.append(all_tests[arg].suite()) 122 suite.addTest(loader.loadTestsFromModule(all_tests[arg]))
116 123
117 runner = unittest.TextTestRunner(**testargs) 124 runner = unittest.TextTestRunner(**testargs)
118 result = runner.run(unittest.TestSuite(suite)) 125 result = runner.run(suite)
119 if not result.wasSuccessful(): 126 if not result.wasSuccessful():
120 sys.exit(1) 127 sys.exit(1)