Skip to content

test: fix Spec Drift INTERNALERROR under pytest-asyncio 1.4.1 / pytest 9.2.0 - #560

Merged
TexasCoding merged 1 commit into
mainfrom
fix/559-pytest-asyncio-scope
Oct 28, 2026
Merged

TexasCoding merged 1 commit into
mainfrom
fix/559-pytest-asyncio-scope

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Closes #559

Root cause

spec-drift.yml runs uv sync --dev (no --locked) with setup-uv falling back to the latest uv (0.13.6), which re-resolved deps (76 vs 75 locked) and installed pytest-asyncio 1.4.1 + pytest 9.2.0 instead of the uv.lock pins. With -W error::UserWarning:

  1. pytest-asyncio 1.4.1 emits PytestDeprecationWarning: asyncio_default_fixture_loop_scope is unset -> INTERNALERROR at configure.
  2. Behind that, pytest 9.2.0 emits PytestWarning: fixture _load is wrapped by @staticmethod above @pytest.fixture (tests/test_contracts.py TestWsSpecDrift) -> collection error.

Fix

  • pyproject.toml: asyncio_default_fixture_loop_scope = "function" (matches current effective behavior for function fixtures; the one class-scoped fixture is sync).
  • tests/test_contracts.py: put @pytest.fixture above @staticmethod.

Blast radius (by hand)

Test config + one test decorator only. No kalshi/ package code, no public API, no generated code, no release needed. Only async fixtures are affected by the loop-scope setting; all are function scope.

Verification

  • ruff, mypy clean
  • unit (lock): 4935 passed, 3 skipped
  • unit with pytest-asyncio 1.4.1 + pytest 9.2.0, -W error::UserWarning: 4935 passed, 3 skipped
  • strict contracts with 1.4.1/9.2.0: 902 passed; with lock: 902 passed

…r order for pytest-asyncio 1.4.1 / pytest 9.2
@TexasCoding
TexasCoding merged commit 5d5d03e into main Oct 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly spec-drift: strict contract tests failing (since 2026-10-28)

1 participant