From 602e5ab14cd49e6b19f531f98aaf2659ec33fcc5 Mon Sep 17 00:00:00 2001 From: Jeff West Date: Wed, 28 Oct 2026 09:51:44 -0500 Subject: [PATCH] test: set asyncio_default_fixture_loop_scope and fix fixture decorator order for pytest-asyncio 1.4.1 / pytest 9.2 --- pyproject.toml | 1 + tests/test_contracts.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 36cb726..3d065b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ ignore_missing_imports = true [tool.pytest.ini_options] testpaths = ["tests"] asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "function" markers = [ "integration: tests that hit the real Kalshi demo API (require credentials)", "integration_real_api_only: endpoints the demo server cannot service (auth-gated roles, demo-broken). Skipped under the default integration run; enable explicitly with -m integration_real_api_only against a prod-like account.", diff --git a/tests/test_contracts.py b/tests/test_contracts.py index 05b466e..45aca3b 100644 --- a/tests/test_contracts.py +++ b/tests/test_contracts.py @@ -1003,9 +1003,9 @@ class TestWsSpecDrift: # be added here with an evidence citation in the notes field of the # corresponding WS_CONTRACT_MAP entry. _DEMO_DIVERGENCE_ALLOWLIST: ClassVar[set[tuple[str, str]]] = set() + @pytest.fixture(autouse=True, scope="class") @staticmethod - @pytest.fixture(autouse=True, scope="class") def _load(request: pytest.FixtureRequest) -> None: request.cls.spec = _load_asyncapi_spec()