Skip to content

fix: define the fallback base_url fixture at module level - #345

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-341-base-url-fixture-deprecation
Nov 3, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-341-base-url-fixture-deprecation

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Fixes #341.

pytest 9.2 deprecates session-scoped fixtures defined as instance methods (PytestRemovedIn10Warning). The base_url fallback that the plugin registers when pytest-base-url is not in use was an instance of _BaseUrlFallback with a base_url method, so every test using page reported the warning and errored under -W error::pytest.PytestRemovedIn10Warning. With pytest-base-url loaded the fallback is never registered, which is why those setups were unaffected.

The fixture now lives in a module, _base_url_fallback.py, and the plugin registers the module instead of an instance. Same change in pytest-playwright-asyncio.

Tests

test_base_url_without_pytest_base_url now asserts that the inner run reports no warnings; it fails on the previous code with pytest 9.2.0. The issue's repro was verified from a built wheel in a bare venv without pytest-base-url, on pytest 9.2.0 (no warning, and passing with the warning turned into an error) and on pytest 8.4.2.

pytest 9.2 deprecates session-scoped fixtures defined as instance
methods. The base_url fallback used when pytest-base-url is not in use
was one, so every test using the page fixture reported a
PytestRemovedIn10Warning. Move the fixture into a module and register
that instead of a class instance, in both plugins.

Fixes #341.
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.

PytestRemovedIn10Warning for base_url with pytest 9.2.0 and pytest-playwright 0.10.0 without pytest-base-url

2 participants