Skip to content

Commit bc28724

Browse files
authored
gh-127146: Emscripten: Add test_sample_profiler skips where needed (#137815)
Emscripten doesn't have the `socket.SO_REUSEADDR` constant; skip tests that require that symbol to exist.
1 parent 8e3244d commit bc28724

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Lib/test/test_sample_profiler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from test.support.os_helper import unlink
2121
from test.support import force_not_colorized_test_class, SHORT_TIMEOUT
2222
from test.support.socket_helper import find_unused_port
23-
from test.support import requires_subprocess
23+
from test.support import requires_subprocess, is_emscripten
2424

2525
PROCESS_VM_READV_SUPPORTED = False
2626

@@ -1792,6 +1792,7 @@ def _verify_coordinator_command(self, mock_popen, expected_target_args):
17921792
# cwd is coordinator_cmd[4]
17931793
self.assertEqual(coordinator_cmd[5:], expected_target_args)
17941794

1795+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
17951796
def test_cli_module_argument_parsing(self):
17961797
test_args = ["profile.sample", "-m", "mymodule"]
17971798

@@ -1818,6 +1819,7 @@ def test_cli_module_argument_parsing(self):
18181819
realtime_stats=False,
18191820
)
18201821

1822+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
18211823
def test_cli_module_with_arguments(self):
18221824
test_args = ["profile.sample", "-m", "mymodule", "arg1", "arg2", "--flag"]
18231825

@@ -1844,6 +1846,7 @@ def test_cli_module_with_arguments(self):
18441846
realtime_stats=False,
18451847
)
18461848

1849+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
18471850
def test_cli_script_argument_parsing(self):
18481851
test_args = ["profile.sample", "myscript.py"]
18491852

@@ -1870,6 +1873,7 @@ def test_cli_script_argument_parsing(self):
18701873
realtime_stats=False,
18711874
)
18721875

1876+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
18731877
def test_cli_script_with_arguments(self):
18741878
test_args = ["profile.sample", "myscript.py", "arg1", "arg2", "--flag"]
18751879

@@ -1938,6 +1942,7 @@ def test_cli_no_target_specified(self):
19381942
error_msg = mock_stderr.getvalue()
19391943
self.assertIn("one of the arguments", error_msg)
19401944

1945+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
19411946
def test_cli_module_with_profiler_options(self):
19421947
test_args = [
19431948
"profile.sample", "-i", "1000", "-d", "30", "-a",
@@ -1967,6 +1972,7 @@ def test_cli_module_with_profiler_options(self):
19671972
realtime_stats=False,
19681973
)
19691974

1975+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
19701976
def test_cli_script_with_profiler_options(self):
19711977
"""Test script with various profiler options."""
19721978
test_args = [
@@ -2013,6 +2019,7 @@ def test_cli_empty_module_name(self):
20132019
error_msg = mock_stderr.getvalue()
20142020
self.assertIn("argument -m/--module: expected one argument", error_msg)
20152021

2022+
@unittest.skipIf(is_emscripten, "socket.SO_REUSEADDR does not exist")
20162023
def test_cli_long_module_option(self):
20172024
test_args = ["profile.sample", "--module", "mymodule", "arg1"]
20182025

0 commit comments

Comments
 (0)