summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@hp.com>2014-05-19 06:24:25 +1200
committerRobert Collins <robertc@robertcollins.net>2014-05-19 06:24:25 +1200
commit9d56f842f16dad526930f094a7cb7f36824efa9a (patch)
tree0157ca0de5754d642698b14d3bcb61cb6bc26fac
parent7d30604da5cdb80831a0dbed59956ad68c836e37 (diff)
downloadtestrepository-9d56f842f16dad526930f094a7cb7f36824efa9a.tar.gz
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)
-rw-r--r--NEWS3
-rw-r--r--testrepository/testcommand.py2
-rw-r--r--testrepository/tests/test_testcommand.py11
3 files changed, 15 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 17b92aa..1a27f3b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ CHANGES
* ``run`` was outputting bad MIME types - test/plain, not text/plain.
(Robert Collins)
+* Test filtering was failing under python3 and would only apply the
+ filters to the first test listed by discover. (Clark Boylan, #1317607)
+
* When list-tests encounters an error, a much clearer response will
now be shown. (Robert Collins, #1271133)
diff --git a/testrepository/testcommand.py b/testrepository/testcommand.py
index 7101aef..f5a94da 100644
--- a/testrepository/testcommand.py
+++ b/testrepository/testcommand.py
@@ -279,7 +279,7 @@ class TestListingFixture(Fixture):
"""
if self.test_filters is None:
return test_ids
- filters = map(re.compile, self.test_filters)
+ filters = list(map(re.compile, self.test_filters))
def include(test_id):
for pred in filters:
if pred.search(test_id):
diff --git a/testrepository/tests/test_testcommand.py b/testrepository/tests/test_testcommand.py
index cdaeaa8..3259e68 100644
--- a/testrepository/tests/test_testcommand.py
+++ b/testrepository/tests/test_testcommand.py
@@ -575,3 +575,14 @@ class TestTestCommand(ResourcedTestCase):
fixture = self.useFixture(command.get_run_command(
test_ids=['return', 'of', 'the', 'king'], test_filters=filters))
self.assertEqual(['return'], fixture.test_ids)
+
+ def test_filter_tests_by_regex_supplied_ids_multi_match(self):
+ ui, command = self.get_test_ui_and_cmd()
+ ui.proc_outputs = [_b('returned\nids\n')]
+ self.set_config(
+ '[DEFAULT]\ntest_command=foo $LISTOPT $IDLIST\ntest_id_list_default=whoo yea\n'
+ 'test_list_option=--list\n')
+ filters = ['return']
+ fixture = self.useFixture(command.get_run_command(
+ test_ids=['return', 'of', 'the', 'king', 'thereisnoreturn'], test_filters=filters))
+ self.assertEqual(['return', 'thereisnoreturn'], fixture.test_ids)