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

TST: Use pytest.warns() for warnings, and .raises() for exceptions #1325

Merged
merged 1 commit into from Sep 10, 2022

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Sep 4, 2022

Replace the warning-as-exception checks with use of pytest.warns()
that is more semantically correct and works correctly when the tests
are run without -Werror (e.g. because -Werror tends to cause test suites
to crash on irrelevant deprecation warnings from other components).
While at it, replace the homegrown exception checks in test_orientations
with pytest.raises().

Replace the warning-as-exception checks with use of `pytest.warns()`
that is more semantically correct and works correctly when the tests
are run without -Werror (e.g. because -Werror tends to cause test suites
to crash on irrelevant deprecation warnings from other components).
While at it, replace the homegrown exception checks in test_orientations
with `pytest.raises()`.
@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Merging #1325 (3f9c468) into main (4073b2a) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1325   +/-   ##
=======================================
  Coverage   94.85%   94.85%           
=======================================
  Files          30       30           
  Lines        5097     5097           
  Branches     1049     1049           
=======================================
  Hits         4835     4835           
  Misses        153      153           
  Partials      109      109           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@MartinThoma MartinThoma changed the title tests: Use pytest.warns() for warnings, and .raises() for exceptions TST: Use pytest.warns() for warnings, and .raises() for exceptions Sep 10, 2022
@MartinThoma MartinThoma merged commit 2bbccf7 into py-pdf:main Sep 10, 2022
@MartinThoma
Copy link
Member

MartinThoma commented Sep 10, 2022

That looks a lot cleaner - good work 👍

@MartinThoma
Copy link
Member

If you want l'll add you to https://pypdf2.readthedocs.io/en/latest/meta/CONTRIBUTORS.html :-)

@mgorny
Copy link
Contributor Author

mgorny commented Sep 10, 2022

Thanks. I'm fine either way.

MartinThoma added a commit that referenced this pull request Sep 11, 2022
Bug Fixes (BUG):
-  Fix Error in transformations (#1341)
-  Decode #23 in NameObject (#1342)

Testing (TST):
-  Use pytest.warns() for warnings, and .raises() for exceptions (#1325)

Full Changelog: 2.10.6...2.10.7
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.

None yet

2 participants