pytest-django
pytest-django copied to clipboard
Add django_debug_sql ini option
TODO:
- [ ] doc
- [ ] use a command line option instead?
I've thought about having a fixture also, but it would require to set
"force_debug_cursor" on the connections then, and it probably not
useful; typically you want to use this for a short time only - therefore
a command line option might be better suited also (but you can use -o django_debug_sql = 1). And on the other hand, it will only show up on
failures, and is therefore maybe good to set it in general.
Codecov Report
Merging #725 into master will increase coverage by
0.87%. The diff coverage is100%.
@@ Coverage Diff @@
## master #725 +/- ##
==========================================
+ Coverage 97.06% 97.93% +0.87%
==========================================
Files 32 33 +1
Lines 2009 1891 -118
Branches 153 150 -3
==========================================
- Hits 1950 1852 -98
+ Misses 43 26 -17
+ Partials 16 13 -3
| Impacted Files | Coverage Δ | |
|---|---|---|
| tests/test_db_debug.py | 100% <100%> (ø) |
|
| pytest_django/fixtures.py | 96.65% <100%> (-0.23%) |
:arrow_down: |
| pytest_django/plugin.py | 94.04% <100%> (+2.25%) |
:arrow_up: |
| pytest_django/live_server_helper.py | 92.18% <0%> (-4.74%) |
:arrow_down: |
| tests/test_database.py | 99.16% <0%> (-0.1%) |
:arrow_down: |
| tests/test_fixtures.py | 99.6% <0%> (-0.04%) |
:arrow_down: |
| tests/test_urls.py | 100% <0%> (ø) |
:arrow_up: |
| tests/test_manage_py_scan.py | 100% <0%> (ø) |
:arrow_up: |
| tests/test_django_settings_module.py | 100% <0%> (ø) |
:arrow_up: |
| ... and 8 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update ce5d5bc...fb6fa96. Read the comment docs.
I'd really like to see this baked into pytest-django!
I hadn't seen this PR, but I'm currently using it through conftest.py like this
This would indeed be very handy.
Thanks for the workaround @fopina