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

Fix warnings raised during testing. #522

Merged
merged 1 commit into from
Sep 16, 2021
Merged

Conversation

ngnpope
Copy link
Contributor

@ngnpope ngnpope commented Sep 16, 2021

Django raises RuntimeWarning when duplicate models are registered. By declaring the models inside a test function which uses @pytest.mark.parametrize(...), many messages can be triggered. These generate noise in the pytest summary.

I wasn't sure whether it was more desirable to keep the models close to their respective test function or group them at the top. I went for the former...

@codecov
Copy link

codecov bot commented Sep 16, 2021

Codecov Report

Merging #522 (6b79874) into master (93935c7) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #522   +/-   ##
=======================================
  Coverage   98.62%   98.62%           
=======================================
  Files          58       58           
  Lines        5951     5951           
=======================================
  Hits         5869     5869           
  Misses         82       82           
Impacted Files Coverage Δ
tests/test_regressions.py 100.00% <100.00%> (ø)
tests/test_versioning.py 100.00% <100.00%> (ø)

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 93935c7...6b79874. Read the comment docs.

tfranzel added a commit that referenced this pull request Sep 16, 2021
@tfranzel tfranzel merged commit 6b79874 into tfranzel:master Sep 16, 2021
@tfranzel
Copy link
Owner

even though i don't like removing the models from the test scope for completeness, these are warnings nonetheless. the tests also serve as documentation and thus should be as isolated and compact as possible.

added a docstring with the test name to make that abundantly clear.

@ngnpope ngnpope deleted the fix-warnings branch September 16, 2021 21:21
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