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

Do not call django.setup() multiple times, test pytest_configure etc order #629

Merged
merged 1 commit into from
Aug 5, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jul 10, 2018

This is done in pytest_configure already (later), and allows for
projects to do stuff before Django is setup in their pytest plugin.

Fixes #531.

TODO:

  • test(s)

The main problem here is that importing models in your conftest.py will not work anymore, because apps are not ready then yet.

I think we should ensure that pytest_load_initial_conftests can be used in a user's plugin, and that _setup_django does not call django.setup multiple times (#531).

@codecov-io
Copy link

codecov-io commented Jul 26, 2018

Codecov Report

Merging #629 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #629      +/-   ##
=========================================
- Coverage   92.46%   92.4%   -0.06%     
=========================================
  Files          32      33       +1     
  Lines        1751    1725      -26     
  Branches      146     143       -3     
=========================================
- Hits         1619    1594      -25     
  Misses         94      94              
+ Partials       38      37       -1
Flag Coverage Δ
#dj110 84.57% <100%> (-0.18%) ⬇️
#dj111 86.66% <100%> (-0.15%) ⬇️
#dj18 85.27% <100%> (-0.28%) ⬇️
#dj19 84.46% <100%> (-0.18%) ⬇️
#dj20 84.86% <100%> (-0.17%) ⬇️
#dj21 80.75% <100%> (-0.23%) ⬇️
#mysql_innodb 84.86% <100%> (-0.17%) ⬇️
#mysql_myisam 84.69% <100%> (-0.18%) ⬇️
#postgres 88.23% <100%> (-0.12%) ⬇️
#py27 89.79% <100%> (-0.1%) ⬇️
#py34 84.46% <100%> (-0.18%) ⬇️
#py35 84.57% <100%> (-0.18%) ⬇️
#py36 85.33% <100%> (-0.17%) ⬇️
#py37 80.75% <100%> (-0.23%) ⬇️
#sqlite 86.78% <100%> (-0.14%) ⬇️
#sqlite_file 84.46% <100%> (-0.18%) ⬇️
Impacted Files Coverage Δ
tests/test_initialization.py 100% <100%> (ø)
pytest_django/plugin.py 86.08% <100%> (-0.09%) ⬇️
pytest_django/fixtures.py 96.91% <0%> (-0.15%) ⬇️
tests/conftest.py 100% <0%> (ø) ⬆️
tests/test_fixtures.py 100% <0%> (+0.4%) ⬆️

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 2cb64e9...ef3eea4. Read the comment docs.

@blueyed blueyed changed the title [WIP/RFC] Do not call _setup_django in pytest_load_initial_conftests [RFC] Do not call _setup_django in pytest_load_initial_conftests Jul 26, 2018
@blueyed blueyed changed the title [RFC] Do not call _setup_django in pytest_load_initial_conftests Do not call django.setup() multiple times, test pytest_configure etc order Jul 26, 2018
@blueyed blueyed merged commit ef8dfa9 into pytest-dev:master Aug 5, 2018
@blueyed blueyed deleted the setup branch August 5, 2018 16:19
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