Skip to content

Commit 9857c93

Browse files
Clark Boylanrbtcollins
Clark Boylan
authored andcommitted
Fix python3 filtering support.
* Test filtering was failing under python3 and would only apply the filters to the first test listed by discover. (Clark Boylan, #1317607)
1 parent 7d30604 commit 9857c93

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ CHANGES
1111
* ``run`` was outputting bad MIME types - test/plain, not text/plain.
1212
(Robert Collins)
1313

14+
* Test filtering was failing under python3 and would only apply the
15+
filters to the first test listed by discover. (Clark Boylan, #1317607)
16+
1417
* When list-tests encounters an error, a much clearer response will
1518
now be shown. (Robert Collins, #1271133)
1619

testrepository/testcommand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def filter_tests(self, test_ids):
279279
"""
280280
if self.test_filters is None:
281281
return test_ids
282-
filters = map(re.compile, self.test_filters)
282+
filters = list(map(re.compile, self.test_filters))
283283
def include(test_id):
284284
for pred in filters:
285285
if pred.search(test_id):

testrepository/tests/test_testcommand.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,14 @@ def test_filter_tests_by_regex_supplied_ids(self):
575575
fixture = self.useFixture(command.get_run_command(
576576
test_ids=['return', 'of', 'the', 'king'], test_filters=filters))
577577
self.assertEqual(['return'], fixture.test_ids)
578+
579+
def test_filter_tests_by_regex_supplied_ids_multi_match(self):
580+
ui, command = self.get_test_ui_and_cmd()
581+
ui.proc_outputs = [_b('returned\nids\n')]
582+
self.set_config(
583+
'[DEFAULT]\ntest_command=foo $LISTOPT $IDLIST\ntest_id_list_default=whoo yea\n'
584+
'test_list_option=--list\n')
585+
filters = ['return']
586+
fixture = self.useFixture(command.get_run_command(
587+
test_ids=['return', 'of', 'the', 'king', 'thereisnoreturn'], test_filters=filters))
588+
self.assertEqual(['return', 'thereisnoreturn'], fixture.test_ids)

0 commit comments

Comments
 (0)