diff options
author | Clark Boylan <clark.boylan@hp.com> | 2014-05-19 06:23:12 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2014-05-19 06:24:25 +1200 |
commit | 9857c934c1937d04ad0a22c895c077ec01ab08e7 (patch) | |
tree | 0157ca0de5754d642698b14d3bcb61cb6bc26fac | |
parent | 7d30604da5cdb80831a0dbed59956ad68c836e37 (diff) | |
download | testrepository-git-9857c934c1937d04ad0a22c895c077ec01ab08e7.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-- | NEWS | 3 | ||||
-rw-r--r-- | testrepository/testcommand.py | 2 | ||||
-rw-r--r-- | testrepository/tests/test_testcommand.py | 11 |
3 files changed, 15 insertions, 1 deletions
@@ -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) |