From 24828ca9db3c63d17f6a4a56114eaa245b49330b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 18 Dec 2025 13:21:57 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Make=20CodSpeed=20tests=20not=20run?= =?UTF-8?q?=20by=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/benchmarks/conftest.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/benchmarks/conftest.py diff --git a/tests/benchmarks/conftest.py b/tests/benchmarks/conftest.py new file mode 100644 index 000000000..082ae49b0 --- /dev/null +++ b/tests/benchmarks/conftest.py @@ -0,0 +1,20 @@ +import pytest + + +def pytest_collection_modifyitems( + config: pytest.Config, items: list[pytest.Item] +) -> None: + # Benchmarks are intentionally skipped unless explicitly requested with --codspeed + # to avoid slowing down regular test runs, and to run them only on + # supported Python versions (e.g. Pydantic v1 only up to Python 3.13). + run_codspeed = bool(getattr(config.option, "codspeed", False)) + + if run_codspeed: + return + + skip_marker = pytest.mark.skip( + reason="Benchmark tests are skipped by default; run with --codspeed." + ) + + for item in items: + item.add_marker(skip_marker)