Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.11] gh-110918: Fix side effects of regrtest test_match_tests() (GH-116718) #116727

Merged
merged 1 commit into from Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Lib/test/libregrtest/filter.py
Expand Up @@ -27,6 +27,11 @@ def _is_full_match_test(pattern):
return ('.' in pattern) and (not re.search(r'[?*\[\]]', pattern))


def get_match_tests():
global _test_patterns
return _test_patterns


def set_match_tests(patterns):
global _test_matchers, _test_patterns

Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_regrtest.py
Expand Up @@ -27,7 +27,7 @@
from test.libregrtest import main
from test.libregrtest import setup
from test.libregrtest import utils
from test.libregrtest.filter import set_match_tests, match_test
from test.libregrtest.filter import get_match_tests, set_match_tests, match_test
from test.libregrtest.result import TestStats
from test.libregrtest.utils import normalize_test_name

Expand Down Expand Up @@ -2234,6 +2234,10 @@ def __init__(self, test_id):
def id(self):
return self.test_id

# Restore patterns once the test completes
patterns = get_match_tests()
self.addCleanup(set_match_tests, patterns)

test_access = Test('test.test_os.FileTests.test_access')
test_chdir = Test('test.test_os.Win32ErrorTests.test_chdir')
test_copy = Test('test.test_shutil.TestCopy.test_copy')
Expand Down