Skip to content

fix(ci): run pytest in PR validation and fix the stale beta.responses assertion - #586

Open
rajarshidattapy wants to merge 1 commit into
OpenRouterTeam:mainfrom
rajarshidattapy:fix/run-tests-in-ci
Open

fix(ci): run pytest in PR validation and fix the stale beta.responses assertion#586
rajarshidattapy wants to merge 1 commit into
OpenRouterTeam:mainfrom
rajarshidattapy:fix/run-tests-in-ci

Conversation

@rajarshidattapy

Copy link
Copy Markdown

Body

Fixes#585.

Problem

tests/test_responses_namespace.py has been failing on main since 2026-07-25, and nothing
caught it: pytest is not installed by uv sync --group dev, and pr-validation.yaml runs
uv build / mypy / pyright / pylint but never the tests. PR validation is green while the
suite is red.

Change

.speakeasy/gen.yaml | +4 -2 pytest deps at the generator source
pyproject.toml | +2 the same deps in the generated output
uv.lock | +83 lockfile
.github/workflows/pr-validation.yaml | +3 Test (pytest) step
tests/test_responses_namespace.py | +16 -2 stale assertion replaced

Dev dependencies go in gen.yaml, not only pyproject.toml.pyproject.toml is listed
in .speakeasy/gen.lock, so it is generator-owned — adding pytest there alone would
survive until the next regeneration and then silently disappear. python.additionalDependencies.dev
was {}; it now carries both packages, and pyproject.toml has the matching lines so the
branch works today without waiting on a regen. Pinned exactly (==9.1.1, ==1.4.0) to match
the existing mypy / pylint / pyright pins.

pytest-asyncio is included because pyproject.toml already declares
asyncio_default_fixture_loop_scope, which without the plugin emits
PytestConfigWarning: Unknown config option on every run. That warning is now gone.

The CI step is uv run --group dev pytest tests, added after the pylint step.

The assertion was stale, not a real defect

c75a93c (2026-07-24) added the test when beta.py did self.responses = Responses(...)
literally the same class, so type(client.responses) is type(client.beta.responses) held.
1477485 (2026-07-25) changed it to self.responses = BetaResponses(...), a distinct
generated class, and the identity check broke the next day.

The alias itself is healthy, so this replaces the assertion rather than the behavior. It now
checks what the test name claims: both namespaces expose send / send_async, their public
surfaces are equal, and the alias's docstring still says "deprecated".

That last assertion is deliberate. deprecated-beta-responses-alias.overlay.yaml's own
comments warn that the overlay can silently match nothing after a monorepo sync and drop the
deprecation notice, and nothing was checking for it. I confirmed the check discriminates —
the GA class's docstring is "OpenAI-compatible Responses API endpoints", with no
"deprecated" in it, so a lost notice fails the test rather than passing vacuously.

Verification

Ran the full PR-validation job locally, plus the new step:

  • uv build — both sdist and wheel
  • uv run --group dev mypy src — no issues in 769 source files
  • uv run --group dev pyright src — 0 errors, 0 warnings, 0 informations
  • uv run --group dev pylint src --rcfile pylintrc — 10.00/10
  • uv run --group dev pytest tests4 passed, no warnings

That last command is the one that could not resolve pytest before this change.

Sign up for freeto 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.

Test suite is red on main and CI never runs it: pytest is in neither the dev group nor pr-validation.yaml

1 participant

@rajarshidattapy