Mercurial > hgsubversion
comparison tests/run.py @ 833:312b37bc5e20
tests: avoid shadowing Python builtin all()
author | Yonggang Luo <luoyonggang@gmail.com> |
---|---|
date | Wed, 12 Oct 2011 15:43:31 +0800 |
parents | e830b592917b |
children | d3ff5807f1bd |
comparison
equal
deleted
inserted
replaced
832:e9af7eba88db | 833:312b37bc5e20 |
---|---|
91 # silence output when running outside nose | 91 # silence output when running outside nose |
92 if not options.showstdout: | 92 if not options.showstdout: |
93 import tempfile | 93 import tempfile |
94 sys.stdout = tempfile.TemporaryFile() | 94 sys.stdout = tempfile.TemporaryFile() |
95 | 95 |
96 all = tests() | 96 all_tests = tests() |
97 | 97 |
98 args = [i.split('.py')[0].replace('-', '_') for i in args] | 98 args = [i.split('.py')[0].replace('-', '_') for i in args] |
99 | 99 |
100 if not args: | 100 if not args: |
101 check = lambda x: options.comprehensive or not comprehensive(x) | 101 check = lambda x: options.comprehensive or not comprehensive(x) |
102 mods = [m for (n, m) in sorted(all.iteritems()) if check(m)] | 102 mods = [m for (n, m) in sorted(all_tests.iteritems()) if check(m)] |
103 suite = [m.suite() for m in mods] | 103 suite = [m.suite() for m in mods] |
104 else: | 104 else: |
105 suite = [] | 105 suite = [] |
106 for arg in args: | 106 for arg in args: |
107 if arg == 'test_util': | 107 if arg == 'test_util': |
108 continue | 108 continue |
109 elif arg not in all: | 109 elif arg not in all_tests: |
110 print >> sys.stderr, 'test module %s not available' % arg | 110 print >> sys.stderr, 'test module %s not available' % arg |
111 else: | 111 else: |
112 suite.append(all[arg].suite()) | 112 suite.append(all_tests[arg].suite()) |
113 | 113 |
114 runner = unittest.TextTestRunner(**testargs) | 114 runner = unittest.TextTestRunner(**testargs) |
115 result = runner.run(unittest.TestSuite(suite)) | 115 result = runner.run(unittest.TestSuite(suite)) |
116 if not result.wasSuccessful(): | 116 if not result.wasSuccessful(): |
117 sys.exit(1) | 117 sys.exit(1) |