Skip to content

Add django_debug_sql ini option - #725

Open
blueyed wants to merge 1 commit into
pytest-dev:mainfrom
blueyed:debug-sql
Open

Add django_debug_sql ini option#725
blueyed wants to merge 1 commit into
pytest-dev:mainfrom
blueyed:debug-sql

Conversation

@blueyed

@blueyed blueyed commented May 5, 2019

Copy link
Copy Markdown
Contributor

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-io

codecov-io commented May 5, 2019

Copy link
Copy Markdown

Codecov Report

Merging #725 into master will increase coverage by 0.87%.
The diff coverage is 100%.

Impacted file tree graph

@@            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%) ⬇️
pytest_django/plugin.py 94.04% <100%> (+2.25%) ⬆️
pytest_django/live_server_helper.py 92.18% <0%> (-4.74%) ⬇️
tests/test_database.py 99.16% <0%> (-0.1%) ⬇️
tests/test_fixtures.py 99.6% <0%> (-0.04%) ⬇️
tests/test_urls.py 100% <0%> (ø) ⬆️
tests/test_manage_py_scan.py 100% <0%> (ø) ⬆️
tests/test_django_settings_module.py 100% <0%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce5d5bc...fb6fa96. Read the comment docs.

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.
@fopina

fopina commented May 28, 2020

Copy link
Copy Markdown

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

@danihodovic

danihodovic commented Jun 3, 2020

Copy link
Copy Markdown

This would indeed be very handy.

Thanks for the workaround @fopina

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.

4 participants