Repository navigation
Add request_factory as a readable alias for rf - #1323
Open
prabhjot1028 wants to merge 1 commit into
Open
prabhjot1028 wants to merge 1 commit into
prabhjot1028 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
The abbreviated
rffixture can be hard to discover or understand when reading tests. Addrequest_factoryas a descriptive alias while preservingrfand its existing behavior.The alias depends on and returns
rf, so requesting both names uses the sameRequestFactoryinstance and respects localrfoverrides. Register and export the fixture, document its use, and add a changelog entry.Tests cover constructing a GET request through the new name and object identity when both fixtures are requested. Both new tests first failed with
fixture 'request_factory' not foundagainst the original library.Validation on Windows with Python 3.13.7, Django 5.2.18, and pytest 9.1.1:
python -m pytest tests/test_fixtures.py --ds=pytest_django_test.settings_sqlite— 56 passed.python -m pytest --ds=pytest_django_test.settings_sqlite— 242 passed, 2 skipped.python -m build,python -m compileall -q pytest_django, andpython -m pip check.sphinx-build -n -W.The unchanged baseline passed 240 tests with 2 expected SQLite skips after preserving LF checkout endings on Windows. No database services were required for the local verification.
Fixes #1252
AI assistance: developed with assistance from OpenAI Codex.