Skip to content

Commit

Permalink
Adjust import timings test for python 3.12 (#8260)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Mar 29, 2024
1 parent c21b76d commit 2434bfe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def test_web___all__(pytester: pytest.Pytester) -> None:
result.assert_outcomes(passed=0, errors=0)


_TARGET_TIMINGS_BY_PYTHON_VERSION = {
"3.12": 250, # 3.12 is expected to be a bit slower due to performance trade-offs
}


@pytest.mark.skipif(
not sys.platform.startswith("linux") or platform.python_implementation() == "PyPy",
reason="Timing is more reliable on Linux",
Expand Down Expand Up @@ -59,4 +64,7 @@ def test_import_time(pytester: pytest.Pytester) -> None:
else:
os.environ["PYTHONPATH"] = old_path

assert best_time_ms < 200
expected_time = _TARGET_TIMINGS_BY_PYTHON_VERSION.get(
f"{sys.version_info.major}.{sys.version_info.minor}", 200
)
assert best_time_ms < expected_time

0 comments on commit 2434bfe

Please sign in to comment.