Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fixture which gives access to all databases in tests #1113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"db",
"transactional_db",
"django_db_reset_sequences",
"django_db_all_databases",
"django_db_serialized_rollback",
"admin_user",
"django_user_model",
Expand Down Expand Up @@ -190,6 +191,7 @@ def _django_db_helper(
or ("transactional_db" in request.fixturenames or "live_server" in request.fixturenames)
)
reset_sequences = reset_sequences or ("django_db_reset_sequences" in request.fixturenames)
databases = databases or ("__all__" if "django_db_all_databases" in request.fixturenames else None)
serialized_rollback = serialized_rollback or (
"django_db_serialized_rollback" in request.fixturenames
)
Expand Down Expand Up @@ -397,6 +399,10 @@ def django_db_serialized_rollback(
# is requested.


def django_db_all_databases(_django_db_helper: None):
"""TODO: write a docstring"""


@pytest.fixture()
def client() -> django.test.Client:
"""A Django test client instance."""
Expand Down