Update the docs when overriding django_db_setup#1190
Update the docs when overriding django_db_setup#1190kingbuzzman wants to merge 6 commits intopytest-dev:mainfrom
Conversation
|
@bluetech thoughts? |
bluetech
left a comment
There was a problem hiding this comment.
Not a review -- I need to look into it more. Just a couple of typos.
Co-authored-by: Ran Benita <ran@unusedvar.com>
|
@bluetech thoughts? |
There was a problem hiding this comment.
Pull Request Overview
Updates documentation examples for overriding the django_db_setup fixture to correctly use the request parameter and call the original fixture via request.getfixturevalue(). This addresses reported issues where the previous examples would not work properly.
- Adds
requestparameter todjango_db_setupfixture signatures - Changes from bare
yieldtoyield request.getfixturevalue("django_db_setup") - Updates database configuration example to use individual key assignment instead of dictionary replacement
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| run_sql('CREATE DATABASE the_copied_db TEMPLATE the_source_db') | ||
|
|
||
| yield | ||
| yield request.getfixturevalue("django_db_setup") |
There was a problem hiding this comment.
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 |
| settings.DATABASES['default']['HOST'] = 'db.example.com' | ||
| settings.DATABASES['default']['NAME'] = 'external_db' | ||
|
|
||
| yield request.getfixturevalue("django_db_setup") |
There was a problem hiding this comment.
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) |
|
Putting it into draft becuase its been so long, and copilot is making me doubt myself. Im going to make a test.. when i have time to prove this out.. |
Fixes issue: #1183 #1131
See: #1183 (comment)