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

test: Use pytest.raises match argument to check Error messages #2162

Merged
merged 3 commits into from
Apr 6, 2023

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Apr 6, 2023

Description

Resolves #2161

  • This is a much simpler way and more maintainable way to check Error message content rather than manually checking captured output. In the cases where multiple strings need to be checked for still keep checking the values are in str(exc_info.value).
  • Fix checks in tests/test_import.py that were not properly checking the output.

Should go in before PR #2109 to allow that PR to use this as @alexander-held has already started to implement these changes there.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* This is a much simpler way and more maintainable way to check Error
  message content rather than manually checking captured output. In the
  cases where multiple strings need to be checked for still keep
  checking the values are in str(exc_info.value).
* Fix checks in tests/test_import.py that were not properly checking the
  output.

Co-authored-by: Alexander Held <[email protected]>

* This is a much simpler way and more maintainable way to check Error
  message content rather than manually checking captured output. In the
  cases where multiple strings need to be checked for still keep
  checking the values are in str(exc_info.value).
* Fix checks in tests/test_import.py that were not properly checking the
  output.
@matthewfeickert matthewfeickert added tests pytest need-to-backport tmp label until can be backported to patch release branch labels Apr 6, 2023
@matthewfeickert matthewfeickert self-assigned this Apr 6, 2023
@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (d8af4f2) 98.30% compared to head (eb7f5bf) 98.30%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2162   +/-   ##
=======================================
  Coverage   98.30%   98.30%           
=======================================
  Files          69       69           
  Lines        4531     4531           
  Branches      800      800           
=======================================
  Hits         4454     4454           
  Misses         45       45           
  Partials       32       32           
Flag Coverage Δ
contrib 97.88% <ø> (ø)
doctest 61.15% <ø> (ø)
unittests-3.10 96.31% <ø> (ø)
unittests-3.11 96.31% <ø> (ø)
unittests-3.8 96.33% <ø> (ø)
unittests-3.9 96.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@matthewfeickert
Copy link
Member Author

I'm going to approve and merge this myself. As always, PRs approved by a single core dev can be reverted as needed by the rest of the dev team.

@matthewfeickert matthewfeickert merged commit c3a00e8 into main Apr 6, 2023
@matthewfeickert matthewfeickert deleted the test/use-pytest-matches branch April 6, 2023 18:29
matthewfeickert added a commit that referenced this pull request Apr 6, 2023
@matthewfeickert matthewfeickert removed the need-to-backport tmp label until can be backported to patch release branch label Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests pytest
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Use pytest.raises match over checking for string content manually
1 participant