Skip to content

Commit 9ec0365

Browse files
chore: add pytest and pytest-asyncio for testing in CI
1 parent cb401a8 commit 9ec0365

5 files changed

Lines changed: 105 additions & 3 deletions

File tree

‎.github/workflows/pr-validation.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ jobs:
3535

3636
- name: Lint (pylint)
3737
run: uv run --group dev pylint src --rcfile pylintrc
38+
39+
- name: Test (pytest)
40+
run: uv run --group dev pytest tests

‎.speakeasy/gen.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ generation:
3838
python:
3939
version: 1.1.23
4040
additionalDependencies:
41-
dev: {}
41+
dev:
42+
pytest: ==9.1.1
43+
pytest-asyncio: ==1.4.0
4244
main: {}
4345
allowedRedefinedBuiltins:
4446
- id

‎pyproject.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ dev = [
1919
"mypy ==1.15.0",
2020
"pylint ==3.2.3",
2121
"pyright ==1.1.398",
22+
"pytest ==9.1.1",
23+
"pytest-asyncio ==1.4.0",
2224
]
2325

2426
[tool.setuptools.packages.find]

‎tests/test_responses_namespace.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
from openrouter import OpenRouter
22

33

4+
def _public_operations(namespace):
5+
return {name for name in dir(namespace) if not name.startswith("_")}
6+
7+
48
def test_responses_namespace_is_ga_and_beta_alias_remains_available():
59
client = OpenRouter(api_key="test-key")
610

711
assert client.responses is not None
812
assert client.beta.responses is not None
9-
assert type(client.responses) is type(client.beta.responses)
1013
assert client.beta.analytics is not None
14+
15+
# The alias is generated as its own class (BetaResponses), so identity no
16+
# longer holds — what has to stay true is that it exposes the same surface.
17+
operations = _public_operations(client.responses)
18+
assert {"send", "send_async"} <= operations
19+
assert _public_operations(client.beta.responses) == operations
20+
21+
# deprecated-beta-responses-alias.overlay.yaml adds the tag description that
22+
# becomes this docstring. Its own comments warn that the overlay can silently
23+
# match nothing after a monorepo sync and drop the notice, so assert on it.
24+
assert "deprecated" in (type(client.beta.responses).__doc__ or "").lower()

‎uv.lock‎

Lines changed: 82 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)