[3.13] gh-135494: Fix python -m test --pgo -x test_re (#135713) (#135881)

gh-135494: Fix python -m test --pgo -x test_re (#135713)

Fix regrtest to support excluding tests from --pgo tests.

(cherry picked from commit 15c6d63fe6)
This commit is contained in:
Victor Stinner 2025-06-24 12:49:31 +02:00 committed by GitHub
parent 028d56fd78
commit a27398d5b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 6 deletions

View file

@ -2346,6 +2346,17 @@ def check(output):
output = self.run_tests('-j1', '-v', testname, env=env, isolated=False)
check(output)
def test_pgo_exclude(self):
# Get PGO tests
output = self.run_tests('--pgo', '--list-tests')
pgo_tests = output.strip().split()
# Exclude test_re
output = self.run_tests('--pgo', '--list-tests', '-x', 'test_re')
tests = output.strip().split()
self.assertNotIn('test_re', tests)
self.assertEqual(len(tests), len(pgo_tests) - 1)
class TestUtils(unittest.TestCase):
def test_format_duration(self):