Skip to content

Commit 23a226b

Browse files
authored
bpo-38870: Run always tests that heavily use grammar features in test_unparse (GH-17738)
1 parent cbd0408 commit 23a226b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Lib/test/test_unparse.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ class DirectoryTestCase(ASTTestCase):
285285
lib_dir = pathlib.Path(__file__).parent / ".."
286286
test_directories = (lib_dir, lib_dir / "test")
287287
skip_files = {"test_fstring.py"}
288+
run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py",
289+
"test_ast.py", "test_asdl_parser.py"}
288290

289291
_files_to_test = None
290292

@@ -301,9 +303,17 @@ def files_to_test(cls):
301303
if not item.name.startswith("bad")
302304
]
303305

306+
tests_to_run_always = {item for item in items if
307+
item.name in cls.run_always_files}
308+
304309
# Test limited subset of files unless the 'cpu' resource is specified.
305310
if not test.support.is_resource_enabled("cpu"):
306-
items = random.sample(items, 10)
311+
items = set(random.sample(items, 10))
312+
313+
# Make sure that at least tests that heavily use grammar features are
314+
# considered to reduce the change of missing something.
315+
316+
items = list(items | tests_to_run_always)
307317

308318
# bpo-31174: Store the names sample to always test the same files.
309319
# It prevents false alarms when hunting reference leaks.

0 commit comments

Comments
 (0)