Skip to content

Add request_factory as a readable alias for rf - #1323

Open
prabhjot1028 wants to merge 1 commit into
pytest-dev:mainfrom
prabhjot1028:feat/request-factory-alias
Open

prabhjot1028 wants to merge 1 commit into
pytest-dev:mainfrom
prabhjot1028:feat/request-factory-alias

Conversation

@prabhjot1028

Copy link
Copy Markdown

The abbreviated rf fixture can be hard to discover or understand when reading tests. Add request_factory as a descriptive alias while preserving rf and its existing behavior.

The alias depends on and returns rf, so requesting both names uses the same RequestFactory instance and respects local rf overrides. 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 found against the original library.

Validation on Windows with Python 3.13.7, Django 5.2.18, and pytest 9.1.1:

  • Fixture module: python -m pytest tests/test_fixtures.py --ds=pytest_django_test.settings_sqlite — 56 passed.
  • Full SQLite suite: python -m pytest --ds=pytest_django_test.settings_sqlite — 242 passed, 2 skipped.
  • python -m build, python -m compileall -q pytest_django, and python -m pip check.
  • Ruff lint and format checks, mypy, pyupgrade, EditorConfig, workflow lint, and 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.

This branch has not been deployed

No deployments
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.

"rf" alias to "request_factory" (or vice versa)

1 participant