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

unittest: fix assertion errors on unittest reruns #12436

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

bluetech
Copy link
Member

@bluetech bluetech commented Jun 7, 2024

This fixes unittest test reruns when using plugins like pytest-rerunfailures.

The instance property uses AttributeError to check if the instance needs to be initialized, so del is the correct way to clear it, not setting to None.

Regressed in 8.2.2.

Fix #12424

This fixes unittest test reruns when using plugins like
pytest-rerunfailures.

The `instance` property uses AttributeError to check if the instance
needs to be initialized, so `del` is the correct way to clear it, not
setting to `None`.

Regressed in 8.2.2.
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Nice, thanks for tackling this!

@bluetech bluetech merged commit f85289b into pytest-dev:main Jun 7, 2024
27 checks passed
@bluetech bluetech deleted the unittest-rerun-assertion branch June 7, 2024 23:11
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.

pytest 8.2.2 breaks pytest-rerunfailures for tests that inherit unittest.TestCase
2 participants