From bb11c3c967afaf263e00844d4ab461b7fafd6d36 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 22 Nov 2017 20:58:59 +0100 Subject: bpo-31324: Fix test.support.set_match_tests(None) (#4505) --- Lib/test/support/__init__.py | 2 ++ Lib/test/test_support.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 71d9c2c..b7cbdc6 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1931,6 +1931,8 @@ def set_match_tests(patterns): if not patterns: func = None + # set_match_tests(None) behaves as set_match_tests(()) + patterns = () elif all(map(_is_full_match_test, patterns)): # Simple case: all patterns are full test identifier. # The test.bisect utility only uses such full test identifiers. diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 4756def..e06f7b8 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -500,6 +500,11 @@ class TestSupport(unittest.TestCase): self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) + # match all using None + support.set_match_tests(None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + # match the full test identifier support.set_match_tests([test_access.id()]) self.assertTrue(support.match_test(test_access)) -- cgit v0.12