Skip to content

Commit f05e7fa

Browse files
Another try to fix tests
1 parent 7c83517 commit f05e7fa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lib/test/test_get_gc_stats.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
requires_remote_subprocess_debugging,
1414
)
1515

16+
PROCESS_VM_READV_SUPPORTED = False
17+
18+
try:
19+
from _remote_debugging import PROCESS_VM_READV_SUPPORTED
20+
except ImportError:
21+
raise unittest.SkipTest(
22+
"Test only runs when _remote_debugging is available"
23+
)
1624

1725
def get_interpreter_identifiers(gc_stats: tuple[dict[str, str|int|float]]) -> tuple[str,...]:
1826
return tuple(sorted({s["iid"] for s in gc_stats}))
@@ -37,6 +45,15 @@ def get_last_item(gc_stats: tuple[dict[str, str|int|float]],
3745

3846
return item
3947

48+
skip_if_not_supported = unittest.skipIf(
49+
(
50+
sys.platform != "darwin"
51+
and sys.platform != "linux"
52+
and sys.platform != "win32"
53+
),
54+
"Test only runs on Linux, Windows and MacOS",
55+
)
56+
4057

4158
@requires_gil_enabled()
4259
@requires_remote_subprocess_debugging()
@@ -119,6 +136,11 @@ def _check_gc_state(self, before, after):
119136
before["objects_not_transitively_reachable"],
120137
(before, after))
121138

139+
@skip_if_not_supported
140+
@unittest.skipIf(
141+
sys.platform == "linux" and not PROCESS_VM_READV_SUPPORTED,
142+
"Test only runs on Linux with process_vm_readv support",
143+
)
122144
def test_get_gc_stats_for_main_interpreter(self):
123145
before_stats = self._run_child_process(False)
124146
after_stats = self._run_child_process(False)

0 commit comments

Comments
 (0)