-
Notifications
You must be signed in to change notification settings - Fork 351
Update the docs when overriding django_db_setup #1190
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
2e012d7
02f8072
0c5de8c
bf4feea
d8c722a
95b3185
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -334,15 +334,15 @@ Put this into ``conftest.py``:: | |||||
|
|
||||||
|
|
||||||
| @pytest.fixture(scope='session') | ||||||
| def django_db_setup(): | ||||||
| def django_db_setup(requests): | ||||||
| from django.conf import settings | ||||||
|
|
||||||
| settings.DATABASES['default']['NAME'] = 'the_copied_db' | ||||||
|
|
||||||
| run_sql('DROP DATABASE IF EXISTS the_copied_db') | ||||||
| run_sql('CREATE DATABASE the_copied_db TEMPLATE the_source_db') | ||||||
|
|
||||||
| yield | ||||||
| yield request.getfixturevalue("django_db_setup") | ||||||
|
||||||
| yield request.getfixturevalue("django_db_setup") | |
| yield |
kingbuzzman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a circular dependency where django_db_setup tries to get its own fixture value. The correct approach would be to yield from the original fixture or use a different fixture name for the override.
| yield request.getfixturevalue("django_db_setup") | |
| yield from original_django_db_setup(request) |
Uh oh!
There was an error while loading. Please reload this page.