pytest-django icon indicating copy to clipboard operation
pytest-django copied to clipboard

[WIP] Make django_settings_is_configured return the first value always

Open blueyed opened this issue 6 years ago • 2 comments
trafficstars

I have been seeing an issue, where it would return False initially, but later True; causing an AttributeError with the mailoutbox fixture, because mail.outbox was not set on the module.

This can happen with imported code that changes the environment, e.g. via "wsgi/asgi.py":

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "foo.settings")

TODO:

  • [x] test

blueyed avatar Mar 09 '19 23:03 blueyed

Codecov Report

Merging #708 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #708      +/-   ##
==========================================
+ Coverage   98.03%   98.03%   +<.01%     
==========================================
  Files          32       32              
  Lines        1831     1836       +5     
  Branches      142      142              
==========================================
+ Hits         1795     1800       +5     
  Misses         23       23              
  Partials       13       13
Flag Coverage Δ
#dj110 85.62% <100%> (+0.03%) :arrow_up:
#dj111 87.9% <100%> (+0.03%) :arrow_up:
#dj18 86.6% <100%> (+0.03%) :arrow_up:
#dj19 85.67% <100%> (+0.03%) :arrow_up:
#dj20 87.85% <100%> (+0.03%) :arrow_up:
#dj21 85.34% <100%> (+0.04%) :arrow_up:
#dj22 83.22% <100%> (+0.04%) :arrow_up:
#djmaster 81.2% <100%> (+0.05%) :arrow_up:
#mysql_innodb 86.11% <100%> (+0.03%) :arrow_up:
#mysql_myisam 85.94% <100%> (+0.03%) :arrow_up:
#postgres 91.12% <100%> (+0.02%) :arrow_up:
#py27 90.95% <100%> (+0.02%) :arrow_up:
#py34 85.67% <100%> (+0.03%) :arrow_up:
#py35 85.62% <100%> (+0.03%) :arrow_up:
#py36 88.77% <100%> (+0.03%) :arrow_up:
#py37 85.72% <100%> (+0.03%) :arrow_up:
#pytest41 85.07% <100%> (+0.04%) :arrow_up:
#sqlite 90.35% <100%> (+0.02%) :arrow_up:
#sqlite_file 85.67% <100%> (+0.03%) :arrow_up:
#xdist 87.85% <100%> (+0.03%) :arrow_up:
Impacted Files Coverage Δ
pytest_django/lazy_django.py 100% <100%> (ø) :arrow_up:

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 f55c709...3779fc1. Read the comment docs.

codecov-io avatar Mar 09 '19 23:03 codecov-io

Codecov Report

Merging #708 into master will decrease coverage by 0.09%. The diff coverage is 92.59%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #708     +/-   ##
=========================================
- Coverage    98.1%   98.01%   -0.1%     
=========================================
  Files          32       32             
  Lines        1902     1861     -41     
  Branches      149      149             
=========================================
- Hits         1866     1824     -42     
  Misses         23       23             
- Partials       13       14      +1
Flag Coverage Δ
#dj110 85.81% <92.59%> (?)
#dj111 88.07% <92.59%> (?)
#dj18 86.78% <92.59%> (?)
#dj19 85.81% <92.59%> (?)
#dj20 88.01% <92.59%> (?)
#dj21 85.54% <92.59%> (?)
#dj22 83.44% <92.59%> (?)
#djmaster 81.46% <92.59%> (?)
#mysql_innodb 86.29% <92.59%> (?)
#mysql_myisam 86.13% <92.59%> (?)
#postgres 91.24% <92.59%> (?)
#py27 91.08% <92.59%> (?)
#py34 85.81% <92.59%> (?)
#py35 85.81% <92.59%> (?)
#py36 88.93% <92.59%> (?)
#py37 85.92% <92.59%> (?)
#pytest41 85.27% <92.59%> (?)
#sqlite 90.43% <92.59%> (?)
#sqlite_file 85.81% <92.59%> (?)
#xdist 88.01% <92.59%> (?)
Impacted Files Coverage Δ
tests/test_django_settings_module.py 100% <100%> (ø) :arrow_up:
pytest_django/lazy_django.py 100% <100%> (ø) :arrow_up:
pytest_django/plugin.py 94.05% <90%> (+0.01%) :arrow_up:
pytest_django/live_server_helper.py 92.18% <0%> (-4.69%) :arrow_down:
tests/test_db_setup.py 100% <0%> (ø) :arrow_up:
tests/conftest.py 100% <0%> (ø) :arrow_up:
pytest_django/fixtures.py 97.31% <0%> (+0.77%) :arrow_up:

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 d2973e2...74e310a. Read the comment docs.

codecov-io avatar Mar 09 '19 23:03 codecov-io