From b54a1d272e719bc327481ea3ce14c8381d29aaf8 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 9 Jan 2026 05:47:38 +0800 Subject: [PATCH] Add Emscripten test skips for recently added tests. (#143551) Some recent changes introduced tests that can't run on Emscripten. This change adds test skips for those tests. --- Lib/test/test_grammar.py | 9 +++++++-- .../test_profiling/test_sampling_profiler/test_cli.py | 1 + .../test_sampling_profiler/test_collectors.py | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index cfb24a5c4578..ebcd98a0a377 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -1,8 +1,6 @@ # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. -from test.support import check_syntax_error, skip_wasi_stack_overflow -from test.support import import_helper import annotationlib import inspect import unittest @@ -18,6 +16,12 @@ import test.typinganndata.ann_module as ann_module import typing from test.typinganndata import ann_module2 import test +from test.support import ( + check_syntax_error, + import_helper, + skip_emscripten_stack_overflow, + skip_wasi_stack_overflow, +) from test.support.numbers import ( VALID_UNDERSCORE_LITERALS, INVALID_UNDERSCORE_LITERALS, @@ -250,6 +254,7 @@ the \'lazy\' dog.\n\ self.assertIn("was never closed", str(cm.exception)) @skip_wasi_stack_overflow() + @skip_emscripten_stack_overflow() def test_max_level(self): # Macro defined in Parser/lexer/state.h MAXLEVEL = 200 diff --git a/Lib/test/test_profiling/test_sampling_profiler/test_cli.py b/Lib/test/test_profiling/test_sampling_profiler/test_cli.py index f187f6c51d88..0d92bd1796e9 100644 --- a/Lib/test/test_profiling/test_sampling_profiler/test_cli.py +++ b/Lib/test/test_profiling/test_sampling_profiler/test_cli.py @@ -714,6 +714,7 @@ class TestSampleProfilerCLI(unittest.TestCase): with self.assertRaisesRegex(SamplingModuleNotFoundError, "Module '[\\w/.]+' not found."): main() + @unittest.skipIf(is_emscripten, "subprocess not available") def test_cli_attach_nonexistent_pid(self): fake_pid = "99999" with mock.patch("sys.argv", ["profiling.sampling.cli", "attach", fake_pid]): diff --git a/Lib/test/test_profiling/test_sampling_profiler/test_collectors.py b/Lib/test/test_profiling/test_sampling_profiler/test_collectors.py index ae336ccdb941..8e6afa91e89d 100644 --- a/Lib/test/test_profiling/test_sampling_profiler/test_collectors.py +++ b/Lib/test/test_profiling/test_sampling_profiler/test_collectors.py @@ -7,6 +7,8 @@ import os import tempfile import unittest +from test.support import is_emscripten + try: import _remote_debugging # noqa: F401 from profiling.sampling.pstats_collector import PstatsCollector @@ -599,6 +601,7 @@ class TestSampleProfilerComponents(unittest.TestCase): self.assertGreater(stack_table["length"], 0) self.assertGreater(len(stack_table["frame"]), 0) + @unittest.skipIf(is_emscripten, "threads not available") def test_gecko_collector_export(self): """Test Gecko profile export functionality.""" gecko_out = tempfile.NamedTemporaryFile(suffix=".json", delete=False) -- 2.47.3