Skip to content

Commit fe08e34

Browse files
committed
fixup! fixup! Move local imports to module level in sampling profiler
1 parent ea11292 commit fe08e34

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Lib/test/test_profiling/test_sampling_profiler/test_children.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@
1818
requires_remote_subprocess_debugging,
1919
)
2020

21-
from profiling.sampling._child_monitor import (
22-
get_child_pids,
23-
ChildProcessMonitor,
24-
is_python_process,
25-
_MAX_CHILD_PROFILERS,
26-
_CLEANUP_INTERVAL_CYCLES,
27-
)
21+
# Guard imports that require _remote_debugging module.
22+
# This module is not available on all platforms (e.g., WASI).
23+
try:
24+
from profiling.sampling._child_monitor import (
25+
get_child_pids,
26+
ChildProcessMonitor,
27+
is_python_process,
28+
_MAX_CHILD_PROFILERS,
29+
_CLEANUP_INTERVAL_CYCLES,
30+
)
31+
except ImportError:
32+
# Module will be skipped via @requires_remote_subprocess_debugging decorators
33+
get_child_pids = None
34+
ChildProcessMonitor = None
35+
is_python_process = None
36+
_MAX_CHILD_PROFILERS = None
37+
_CLEANUP_INTERVAL_CYCLES = None
2838
from profiling.sampling.cli import (
2939
_add_sampling_options,
3040
_validate_args,

0 commit comments

Comments
 (0)