Skip to content

Commit bb11c3c

Browse files
authored
bpo-31324: Fix test.support.set_match_tests(None) (#4505)
1 parent 803ddd8 commit bb11c3c

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/support/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,8 @@ def set_match_tests(patterns):
19311931

19321932
if not patterns:
19331933
func = None
1934+
# set_match_tests(None) behaves as set_match_tests(())
1935+
patterns = ()
19341936
elif all(map(_is_full_match_test, patterns)):
19351937
# Simple case: all patterns are full test identifier.
19361938
# The test.bisect utility only uses such full test identifiers.

Lib/test/test_support.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ def id(self):
500500
self.assertTrue(support.match_test(test_access))
501501
self.assertTrue(support.match_test(test_chdir))
502502

503+
# match all using None
504+
support.set_match_tests(None)
505+
self.assertTrue(support.match_test(test_access))
506+
self.assertTrue(support.match_test(test_chdir))
507+
503508
# match the full test identifier
504509
support.set_match_tests([test_access.id()])
505510
self.assertTrue(support.match_test(test_access))

0 commit comments

Comments
 (0)