Skip to content
Myr

Improved the logic in which tests are found

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 0851d95 · Browse files · 1 file+12 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−12 removed

  • other:+12 added−12 removed

1 file+12 added−12 removed

modified:run-tests.py+12 added-12 removed
35 unmodified lines
36 if testname.startswith(common_prefix):37 if testname[len(common_prefix):] == name:38 return testcase3940 all_results = []40 all_tests = []41 for testcase, testname in find_all_tests_with_name():42 if testname.endswith('.' + name):43 all_results.append((testcase, testname))42 if testname.endswith('.' + name) or ('.' + name + '.') in testname:43 all_tests.append(testcase)4445 if len(all_results) == 1:46 return all_results[0][0]47 elif not len(all_results):48 error = 'could not find testcase "%s"' % name49 else:50 error = 'Too many matches: for "%s"\n%s' % \51 (name, '\n'.join(' - ' + n for c, n in all_results))45 if not all_tests:46 print >> sys.stderr, 'Error: could not find test case for "%s"' % name47 sys.exit(1)4853 print >> sys.stderr, 'Error: %s' % error54 sys.exit(1)49 if len(all_tests) == 1:50 return all_tests[0]51 rv = unittest.TestSuite()52 for test in all_tests:53 rv.addTest(test)54 return rv555657unittest.main(testLoader=BetterLoader(), defaultTest='suite')