bpo-31324: Fix test.support.set_match_tests(None) (#4505)

This commit is contained in:
Victor Stinner 2017-11-22 20:58:59 +01:00 committed by GitHub
parent 803ddd8ce2
commit bb11c3c967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View 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.

View 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))