Skip to content

refactor(tests): fix few tests, use pytest.raises, extend raises helper#500

Merged
alecthomas merged 3 commits intoalecthomas:masterfrom
antoni-szych-rtbhouse:pytest-raises
Dec 13, 2023
Merged

refactor(tests): fix few tests, use pytest.raises, extend raises helper#500
alecthomas merged 3 commits intoalecthomas:masterfrom
antoni-szych-rtbhouse:pytest-raises

Conversation

@antoni-szych-rtbhouse
Copy link
Contributor

@antoni-szych-rtbhouse antoni-szych-rtbhouse commented Dec 13, 2023

Hi, I thought it would be nice to modernize tests a bit:

  • use with pytest.raises() or with raises() in multiple places
  • parametrize a few tests
  • make raises() manager throw AssertionError if expected exception was not raised inside the context
  • fix 1 or 2 asserts in tests that were incorrectly working due to the above
  • remove python 2 or <3.2 compatibility code (note: this extends beyond tests)

I have some doubts regarding existing tests if they really test what they say they do, especially test_self_any and test_self_all. However it should be checked by someone with more experience (I haven't used Self-related validation yet myself)

Copy link
Owner

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

Good idea!

@alecthomas alecthomas merged commit dec0fcb into alecthomas:master Dec 13, 2023
@antoni-szych-rtbhouse antoni-szych-rtbhouse deleted the pytest-raises branch December 14, 2023 08:26
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