Skip to content

Commit f13f9eb

Browse files
authored
cuda_core/tests/test_event.py::test_timing_success with generous_tolerance if platform_is_wsl (#740)
1 parent f80766c commit f13f9eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cuda_core/tests/test_event.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
import pathlib
6+
import platform
67
import time
78

89
import numpy as np
@@ -21,6 +22,10 @@
2122
)
2223

2324

25+
def platform_is_wsl():
26+
return platform.system() == "Linux" and "microsoft" in pathlib.Path("/proc/version").read_text().lower()
27+
28+
2429
def test_event_init_disabled():
2530
with pytest.raises(RuntimeError, match=r"^Event objects cannot be instantiated directly\."):
2631
cuda.core.experimental._event.Event() # Ensure back door is locked.
@@ -40,7 +45,7 @@ def test_timing_success(init_cuda):
4045
# We only want to exercise the __sub__ method, this test is not meant
4146
# to stress-test the CUDA driver or time.sleep().
4247
delay_ms = delay_seconds * 1000
43-
if os.name == "nt": # noqa: SIM108
48+
if os.name == "nt" or platform_is_wsl(): # noqa: SIM108
4449
# For Python <=3.10, the Windows timer resolution is typically limited to 15.6 ms by default.
4550
generous_tolerance = 100
4651
else:

0 commit comments

Comments
 (0)