]> granicus.if.org Git - python/commitdiff
bpo-31324: Fix test.support.set_match_tests(None) (#4505)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 22 Nov 2017 19:58:59 +0000 (20:58 +0100)
committerGitHub <noreply@github.com>
Wed, 22 Nov 2017 19:58:59 +0000 (20:58 +0100)
Lib/test/support/__init__.py
Lib/test/test_support.py

index 71d9c2c87959050c0c27c015ff8a5f5fc571640d..b7cbdc6ab3054221ed8452833bc966f7a0505eda 100644 (file)
@@ -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.
index 4756defa5f79b74f240d1698e6375e0bd7609e00..e06f7b8e9952b8dba149af8b909500975010f310 100644 (file)
@@ -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))