test(session): define the shared config/manager fixtures once in conftest.py - #281
Merged
Merged
Conversation
…test.py Five session test files each defined their own config and manager fixtures. They now come from tests/session/conftest.py, together with the backend fixture test_manager.py used alongside manager. test_hardening.py keeps its own config (IP binding on), which the shared manager picks up.
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #187
Part of #123.
tests/session/conftest.pynow defines three fixtures, and the five files that had their own copies use them:backend: aMemoryBackend;config:SessionConfig(secret_key="a" * 32);manager:SessionManager(backend, config).What each file had:
test_middleware.py,test_get_session_manager.pyandtest_starlette_middleware.py:configandmanagerexactly as above. Both are removed.test_manager.py: the same three fixtures, but itsconfigpassedsession_ttl=3600, which isSessionConfig's default. All three are removed. Its tests that take bothmanagerandbackendstill get the same backend instance, because the sharedmanageris built from the sharedbackendfixture.test_hardening.py: itsconfigdiffers (ip_binding=True), so it stays local and overrides the shared one. Itsmanagerwas identical and is removed; the sharedmanagerpicks up the localconfigthrough normal fixture overriding.No other file under
tests/session/defines these fixture names or takes abackendargument.Verification
uv run pytest(live servers skipped): 841 passed, 190 skipped.session_ttl=1in the sharedmanagerfails 2 session tests, so the shared fixtures are in use;test_hardening.py's localconfigtoip_binding=Falsefails 1 hardening test, so the override still reaches the sharedmanager.ruff checkand pre-commit pass.CHANGELOG
None: test-only.