Skip to content

Commit 483e301

Browse files
authored
Limit TimeConstrained tests if unpatched stopit (#1302)
Some of the `TimeConstrained[]` tests do not work if we have the last PyPI distributed stopit.
1 parent 367b4bd commit 483e301

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/builtin/test_datentime.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@
99

1010
import pytest
1111

12+
try:
13+
from stopit import __version__ as stopit_version
14+
except ImportError:
15+
have_stopit_for_timeconstrained = False
16+
else:
17+
have_stopit_for_timeconstrained = stopit_version.split(".")[:3] >= ["1", "1", "3"]
18+
1219

1320
@pytest.mark.skipif(
1421
sys.platform in ("emscripten",),
15-
reason="TimeConstrained is not supported in Pyodide",
22+
reason="TimeRemaining[] is not supported in Pyodide",
1623
)
1724
def test_timeremaining():
1825
str_expr = "TimeConstrained[1+2; TimeRemaining[], 0.9]"
@@ -22,7 +29,7 @@ def test_timeremaining():
2229

2330
@pytest.mark.skipif(
2431
sys.platform in ("emscripten",),
25-
reason="TimeConstrained is not supported in Pyodide",
32+
reason="TimeConstrained[] is not supported in Pyodide",
2633
)
2734
def test_timeconstrained1():
2835
"""
@@ -144,8 +151,8 @@ def test_private_doctests_datetime(str_expr, msgs, str_expected, fail_msg):
144151

145152

146153
@pytest.mark.skipif(
147-
sys.platform in ("emscripten",),
148-
reason="TimeConstrained is not supported in Piodide",
154+
sys.platform in ("emscripten",) or not have_stopit_for_timeconstrained,
155+
reason="TimeConstrained[] is not supported in Pyodide or an unpatched 'stopit'",
149156
)
150157
@pytest.mark.parametrize(
151158
("str_expr", "msgs", "str_expected", "fail_msg"),

0 commit comments

Comments
 (0)