build(deps): replace pytest-cases with native pytest fixtures - #279
build(deps): replace pytest-cases with native pytest fixtures#279toby-coleman wants to merge 2 commits into
Conversation
|
Benchmark comparison for |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
pytest-cases 3.10.1 builds the private _pytest.python.IdMaker positionally, so it fails to import under pytest 9.1, and its SuperClosure prunes the fixture that pytest-asyncio 1.4 injects for loop factories. Both upstream fixes are unreleased, so the test extras were pinned below those versions. The suite used pytest-cases only to reference a fixture from a parametrisation. Fixture unions become plain parametrised fixtures plus pytest-lazy-fixtures lf(), which resolves references through public pytest APIs, so the pytest and pytest-asyncio bounds reopen. The uvloop loop factory hook also takes effect for the first time: pytest-asyncio 1.3 has no such hookspec, so the suite ran on the default event loop. tests/unit/test_conftest.py now asserts the running loop instead of the hook return value. Refs smarie/python-pytest-cases#385
8555e7d to
f22ce74
Compare
|
Benchmark comparison for |
|
Benchmark comparison for |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are cohesive and test-focused, and the only noted follow-ups are minor test-ID readability improvements rather than correctness blockers.
Pull request overview
This PR removes the pytest-cases dependency by rewriting test parametrization using native pytest fixtures/@pytest.mark.parametrize, while updating test dependencies to support newer pytest/pytest-asyncio and keeping connector-variant setup (including ZMQ proxy on/off) explicit and safely restored.
Changes:
- Replaced
pytest-casesfixtures/parametrization withpytestfixtures, indirect parametrization, and per-module connector matrices. - Added shared
ConnectorCase+configured_connectorplumbing intests/conftest.pyand regression tests ensuring settings restoration and uvloop usage. - Updated
pyproject.toml/uv.lockto removepytest-casesand allowpytest9.1+ withpytest-asyncio1.4+.
File summaries
| File | Description |
|---|---|
| uv.lock | Removes pytest-cases (and transitive deps) and updates pins for pytest/pytest-asyncio. |
| pyproject.toml | Updates test dependency ranges and drops pytest-cases. |
| tests/conftest.py | Introduces ConnectorCase, configured_connector, and an indirect connector_cls fixture; keeps uvloop loop factory hook. |
| tests/unit/test_connector_pubsub.py | Switches connector parametrization to native pytest fixture + @pytest.mark.parametrize. |
| tests/unit/test_conftest.py | Updates uvloop verification test and adds regression coverage for connector settings restoration. |
| tests/unit/test_channel.py | Replaces pytest-cases connector matrices with ConnectorCase-backed fixtures (incl. mp variant). |
| tests/integration/test_state_backend_multiprocess.py | Replaces pytest-cases parametrization with pytest.mark.parametrize. |
| tests/integration/test_process_with_components_run.py | Converts connector matrix to indirect parametrization using ConnectorCase (proxy on/off explicit). |
| tests/integration/test_process_stop_cancel.py | Converts connector matrix to indirect parametrization using ConnectorCase (proxy on/off explicit). |
| tests/integration/test_connector_pubsub.py | Updates connector fixture and parametrization away from pytest-cases. |
| tests/integration/test_component_event_handlers.py | Updates connector fixture to use ConnectorCase (proxy on/off explicit). |
| tests/integration/test_component_decorator.py | Replaces pytest-cases parametrization with pytest.mark.parametrize. |
| tests/integration/test_channel.py | Updates connector fixtures (including mp) and parametrization away from pytest-cases. |
Review details
- Files reviewed: 12/13 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| (RayProcess, ConnectorCase(RabbitMQConnector)), | ||
| ], | ||
| indirect=["connector_cls"], | ||
| ids=connector_case_id, |
| (RayProcess, ConnectorCase(RabbitMQConnector)), | ||
| ], | ||
| indirect=["connector_cls"], | ||
| ids=connector_case_id, |
pytest-casesprevents upgrading to pytest 9.1 and pytest-asyncio 1.4. Replace its parametrization with native pytest fixtures and indirect parametrization, without adding a replacement plugin.Connector variants are immutable
ConnectorCasevalues, with explicit ZMQ proxy-on and proxy-off cases. A shared context manager applies settings only when requested and restores them on teardown. Module fixtures retain their existing connector matrices; process tests useindirect=["connector_cls"]for setup. This removes the duplicated ZMQ fixtures and preserves main's settings-cleanup fixes.Require
pytest-asyncio>=1.4,<2for the uvloop factory hook, allow pytest 9.1, and assert that tests actually run on uvloop. Removepytest-casesand its unused transitive dependencies from the lockfile.Validation: