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 failing Pytests (deprecation of raises(message=)) #666

Merged
merged 5 commits into from
Aug 24, 2019

Conversation

StanczakDominik
Copy link
Member

@StanczakDominik StanczakDominik commented Aug 22, 2019

This PR fixes currently failing tests caused by the final deprecation in Pytest 5.1 of the message argument to pytest.raises, which we had unwisely muted along with all deprecation warnings in setup.cfg.

It also removes the same argument used in pytest.warns, which is slated for deprecation
in a future release.

@StanczakDominik StanczakDominik changed the title This PR fixes currently failing tests caused by the final deprecation in Pytest 5.1 of the message argument to pytest.raises, which we had unwisely muted along with all deprecation warnings in setup.cfg. Fix failing Pytests (deprecation of raises(message=)) Aug 22, 2019
@codecov
Copy link

codecov bot commented Aug 22, 2019

Codecov Report

Merging #666 into master will increase coverage by 0.88%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #666      +/-   ##
==========================================
+ Coverage   94.07%   94.95%   +0.88%     
==========================================
  Files          54       54              
  Lines        4656     4656              
==========================================
+ Hits         4380     4421      +41     
+ Misses        276      235      -41
Impacted Files Coverage Δ
plasmapy/classes/sources/plasmablob.py 100% <100%> (ø) ⬆️
plasmapy/classes/sources/plasma3d.py 100% <100%> (ø) ⬆️
plasmapy/utils/pytest_helpers.py 92.23% <0%> (+10.86%) ⬆️
plasmapy/mathematics/mathematics.py 100% <0%> (+15%) ⬆️

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 4732d15...76e93bb. Read the comment docs.

@StanczakDominik
Copy link
Member Author

Circleci failures related to miniconda docker image PATH issues: anaconda/docker-images#141

Copy link
Member

@namurphy namurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Thank you for fixing this.

[Also for future reference, the problems with how the message keyword argument in pytest.raises is used incorrectly are described in https://github.com/pytest-dev/pytest/issues/3974.]

@@ -39,7 +39,8 @@ def test_correct_shape_electric_field(self, h5_2d):
assert h5_2d.electric_field.shape == (3, 51, 201)

def test_has_charge_density_with_units(self, h5_2d):
assert h5_2d.charge_density.to(u.C / u.m**3)
# this should simply pass without exception
h5_2d.charge_density.to(u.C / u.m**3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@@ -77,8 +77,6 @@ doctest_plus = enabled
doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS
# TODO we probably need to get rid of the following...
filterwarnings =
once::DeprecationWarning
once::PendingDeprecationWarning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wholeheartedly support this change, now that I think about it. ...as well as after doing an import this.

Errors should never pass silently.
Unless explicitly silenced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll try to tackle the removal of the other warning filters next. Come to think about it, we're probably exposing any potential users to a whole lot of Coupling or RelativityWarnings we have no idea about.

@StanczakDominik
Copy link
Member Author

Thanks for the review @namurphy!

@StanczakDominik StanczakDominik merged commit cf91573 into master Aug 24, 2019
@StanczakDominik StanczakDominik deleted the fix-deprecations branch August 24, 2019 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants