@@ -527,52 +527,100 @@ def id(self):
527527 test_access = Test ('test.test_os.FileTests.test_access' )
528528 test_chdir = Test ('test.test_os.Win32ErrorTests.test_chdir' )
529529
530+ # Test acceptance
530531 with support .swap_attr (support , '_match_test_func' , None ):
531532 # match all
532533 support .set_match_tests ([])
533534 self .assertTrue (support .match_test (test_access ))
534535 self .assertTrue (support .match_test (test_chdir ))
535536
536537 # match all using None
537- support .set_match_tests (None )
538+ support .set_match_tests (None , None )
538539 self .assertTrue (support .match_test (test_access ))
539540 self .assertTrue (support .match_test (test_chdir ))
540541
541542 # match the full test identifier
542- support .set_match_tests ([test_access .id ()])
543+ support .set_match_tests ([test_access .id ()], None )
543544 self .assertTrue (support .match_test (test_access ))
544545 self .assertFalse (support .match_test (test_chdir ))
545546
546547 # match the module name
547- support .set_match_tests (['test_os' ])
548+ support .set_match_tests (['test_os' ], None )
548549 self .assertTrue (support .match_test (test_access ))
549550 self .assertTrue (support .match_test (test_chdir ))
550551
551552 # Test '*' pattern
552- support .set_match_tests (['test_*' ])
553+ support .set_match_tests (['test_*' ], None )
553554 self .assertTrue (support .match_test (test_access ))
554555 self .assertTrue (support .match_test (test_chdir ))
555556
556557 # Test case sensitivity
557- support .set_match_tests (['filetests' ])
558+ support .set_match_tests (['filetests' ], None )
558559 self .assertFalse (support .match_test (test_access ))
559- support .set_match_tests (['FileTests' ])
560+ support .set_match_tests (['FileTests' ], None )
560561 self .assertTrue (support .match_test (test_access ))
561562
562563 # Test pattern containing '.' and a '*' metacharacter
563- support .set_match_tests (['*test_os.*.test_*' ])
564+ support .set_match_tests (['*test_os.*.test_*' ], None )
564565 self .assertTrue (support .match_test (test_access ))
565566 self .assertTrue (support .match_test (test_chdir ))
566567
567568 # Multiple patterns
568- support .set_match_tests ([test_access .id (), test_chdir .id ()])
569+ support .set_match_tests ([test_access .id (), test_chdir .id ()], None )
569570 self .assertTrue (support .match_test (test_access ))
570571 self .assertTrue (support .match_test (test_chdir ))
571572
572- support .set_match_tests (['test_access' , 'DONTMATCH' ])
573+ support .set_match_tests (['test_access' , 'DONTMATCH' ], None )
573574 self .assertTrue (support .match_test (test_access ))
574575 self .assertFalse (support .match_test (test_chdir ))
575576
577+ # Test rejection
578+ with support .swap_attr (support , '_match_test_func' , None ):
579+ # match all
580+ support .set_match_tests (ignore_patterns = [])
581+ self .assertTrue (support .match_test (test_access ))
582+ self .assertTrue (support .match_test (test_chdir ))
583+
584+ # match all using None
585+ support .set_match_tests (None , None )
586+ self .assertTrue (support .match_test (test_access ))
587+ self .assertTrue (support .match_test (test_chdir ))
588+
589+ # match the full test identifier
590+ support .set_match_tests (None , [test_access .id ()])
591+ self .assertFalse (support .match_test (test_access ))
592+ self .assertTrue (support .match_test (test_chdir ))
593+
594+ # match the module name
595+ support .set_match_tests (None , ['test_os' ])
596+ self .assertFalse (support .match_test (test_access ))
597+ self .assertFalse (support .match_test (test_chdir ))
598+
599+ # Test '*' pattern
600+ support .set_match_tests (None , ['test_*' ])
601+ self .assertFalse (support .match_test (test_access ))
602+ self .assertFalse (support .match_test (test_chdir ))
603+
604+ # Test case sensitivity
605+ support .set_match_tests (None , ['filetests' ])
606+ self .assertTrue (support .match_test (test_access ))
607+ support .set_match_tests (None , ['FileTests' ])
608+ self .assertFalse (support .match_test (test_access ))
609+
610+ # Test pattern containing '.' and a '*' metacharacter
611+ support .set_match_tests (None , ['*test_os.*.test_*' ])
612+ self .assertFalse (support .match_test (test_access ))
613+ self .assertFalse (support .match_test (test_chdir ))
614+
615+ # Multiple patterns
616+ support .set_match_tests (None , [test_access .id (), test_chdir .id ()])
617+ self .assertFalse (support .match_test (test_access ))
618+ self .assertFalse (support .match_test (test_chdir ))
619+
620+ support .set_match_tests (None , ['test_access' , 'DONTMATCH' ])
621+ self .assertFalse (support .match_test (test_access ))
622+ self .assertTrue (support .match_test (test_chdir ))
623+
576624 def test_fd_count (self ):
577625 # We cannot test the absolute value of fd_count(): on old Linux
578626 # kernel or glibc versions, os.urandom() keeps a FD open on
0 commit comments