Skip to content
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

[WIP] Make django_settings_is_configured return the first value always #708

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Mar 9, 2019

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:

  • test

@codecov-io
Copy link

codecov-io commented Mar 9, 2019

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%) ⬆️
#dj111 87.9% <100%> (+0.03%) ⬆️
#dj18 86.6% <100%> (+0.03%) ⬆️
#dj19 85.67% <100%> (+0.03%) ⬆️
#dj20 87.85% <100%> (+0.03%) ⬆️
#dj21 85.34% <100%> (+0.04%) ⬆️
#dj22 83.22% <100%> (+0.04%) ⬆️
#djmaster 81.2% <100%> (+0.05%) ⬆️
#mysql_innodb 86.11% <100%> (+0.03%) ⬆️
#mysql_myisam 85.94% <100%> (+0.03%) ⬆️
#postgres 91.12% <100%> (+0.02%) ⬆️
#py27 90.95% <100%> (+0.02%) ⬆️
#py34 85.67% <100%> (+0.03%) ⬆️
#py35 85.62% <100%> (+0.03%) ⬆️
#py36 88.77% <100%> (+0.03%) ⬆️
#py37 85.72% <100%> (+0.03%) ⬆️
#pytest41 85.07% <100%> (+0.04%) ⬆️
#sqlite 90.35% <100%> (+0.02%) ⬆️
#sqlite_file 85.67% <100%> (+0.03%) ⬆️
#xdist 87.85% <100%> (+0.03%) ⬆️
Impacted Files Coverage Δ
pytest_django/lazy_django.py 100% <100%> (ø) ⬆️

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
Copy link

codecov-io commented Mar 9, 2019

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%> (ø) ⬆️
pytest_django/lazy_django.py 100% <100%> (ø) ⬆️
pytest_django/plugin.py 94.05% <90%> (+0.01%) ⬆️
pytest_django/live_server_helper.py 92.18% <0%> (-4.69%) ⬇️
tests/test_db_setup.py 100% <0%> (ø) ⬆️
tests/conftest.py 100% <0%> (ø) ⬆️
pytest_django/fixtures.py 97.31% <0%> (+0.77%) ⬆️

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.

@blueyed blueyed changed the title Make django_settings_is_configured return the first value always [WIP] Make django_settings_is_configured return the first value always Mar 15, 2019
@blueyed blueyed force-pushed the django-configured branch from 0e879ae to 3361768 Compare March 19, 2019 03:46
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")
@blueyed blueyed force-pushed the django-configured branch from 3361768 to 74e310a Compare August 30, 2019 13:36
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.

2 participants