[MERGE] Break sort_tests_by_re into components
John Arbash Meinel
john at arbash-meinel.com
Mon Oct 22 17:50:16 BST 2007
John Arbash Meinel has voted tweak.
Status is now: Conditionally approved
Comment:
+ result = []
+ exclude_re = re.compile(pattern)
+ for test in iter_suite_tests(suite):
+ test_id = test.id()
+ if not exclude_re.search(test_id):
+ result.append(test)
+ return TestUtil.TestSuite(result)
^- Why are you building up into a list rather than doing something like:
result = TestUtil.TestSuite()
...
result.addTest(X)
return result
You don't have to change it, I'm just curious why you chose this route.
def run_suite(suite, name='test', verbose=False, pattern=".*",
@@ -2279,13 +2371,18 @@
(random_seed))
random.seed(random_seed)
# Customise the list of tests if requested
- if pattern != '.*' or exclude_pattern is not None or random_order:
+ if exclude_pattern is not None:
+ suite = exclude_tests_by_re(suite, exclude_pattern)
+ if random_order:
+ order_changer = randomise_suite
+ else:
+ order_changer = preserve_input
+ if pattern != '.*' or random_order:
if matching_tests_first:
- suite = sort_suite_by_re(suite, pattern, exclude_pattern,
- random_order)
+ suites = map(order_change, rsplit_suite_by_re(suite,
pattern))
+ suite = TestUtil.TestSuite(suites)
^- I'm pretty sure that this should be:
suites = map(order_changer, split_suite_by_re(suite, pattern))
Also, since the test suite didn't catch this typo, does that mean we
have a missing test? I guess this is deep in run_suite() which probably
makes it harder to test.
For details, see:
http://bundlebuggy.aaronbentley.com/request/%3C1192926517.27117.1.camel%40lifeless-64%3E
More information about the bazaar
mailing list