Skip to content

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

Merged
MartinThoma merged 1 commit into
py-pdf:mainfrom
mgorny:raises-warns
Sep 10, 2022
Merged

TST: Use pytest.warns() for warnings, and .raises() for exceptions#1325
MartinThoma merged 1 commit into
py-pdf:mainfrom
mgorny:raises-warns

Conversation

@mgorny

@mgorny mgorny commented Sep 4, 2022

Copy link
Copy Markdown
Contributor

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

codecov Bot commented Sep 4, 2022

Copy link
Copy Markdown

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

MartinThoma commented Sep 10, 2022

Copy link
Copy Markdown
Member

That looks a lot cleaner - good work 👍

@MartinThoma

Copy link
Copy Markdown
Member

@mgorny

mgorny commented Sep 10, 2022

Copy link
Copy Markdown
Contributor Author

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
@mgorny
mgorny deleted the raises-warns branch January 27, 2025 06:35
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