Skip to content

Commit 2434bfe

Browse files
authored
Adjust import timings test for python 3.12 (#8260)
1 parent c21b76d commit 2434bfe

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_imports.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def test_web___all__(pytester: pytest.Pytester) -> None:
2828
result.assert_outcomes(passed=0, errors=0)
2929

3030

31+
_TARGET_TIMINGS_BY_PYTHON_VERSION = {
32+
"3.12": 250, # 3.12 is expected to be a bit slower due to performance trade-offs
33+
}
34+
35+
3136
@pytest.mark.skipif(
3237
not sys.platform.startswith("linux") or platform.python_implementation() == "PyPy",
3338
reason="Timing is more reliable on Linux",
@@ -59,4 +64,7 @@ def test_import_time(pytester: pytest.Pytester) -> None:
5964
else:
6065
os.environ["PYTHONPATH"] = old_path
6166

62-
assert best_time_ms < 200
67+
expected_time = _TARGET_TIMINGS_BY_PYTHON_VERSION.get(
68+
f"{sys.version_info.major}.{sys.version_info.minor}", 200
69+
)
70+
assert best_time_ms < expected_time

0 commit comments

Comments
 (0)