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

Drop deprecated pytest.warns(None) #2235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stanislavlevin
Copy link

With Pytest 7:

https://docs.pytest.org/en/stable/changelog.html#pytest-7-0-0rc1-2021-12-06

#8645: pytest.warns(None) is now deprecated because many people used
it to mean “this code does not emit warnings”, but it actually had the
effect of checking that the code emits at least one warning of any
type-like pytest.warns() or pytest.warns(Warning)

With Pytest 8 it's the error.

Changed according to the documentation:
https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests

Fixes: #2234

With Pytest 7:

https://docs.pytest.org/en/stable/changelog.html#pytest-7-0-0rc1-2021-12-06

> #8645: pytest.warns(None) is now deprecated because many people used
  it to mean “this code does not emit warnings”, but it actually had the
  effect of checking that the code emits at least one warning of any
  type-like pytest.warns() or pytest.warns(Warning)

With Pytest 8 it's the error.

Changed according to the documentation:
https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests

Fixes: PyCQA#2234
Signed-off-by: Stanislav Levin <slev@altlinux.org>
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.

[self tests] test_isort_should_warn_on_empty_custom_config_issue_1433 fails against Pytest 8
1 participant