Skip to content

Reducing user confusion from pytest.warns(None) #8645

Closed
@Zac-HD

Description

@Zac-HD

with pytest.warns(None): has the same effect as with pytest.warns(Warning):, but is often confused with the meaning "does not emit any warning". I think we should therefore:

  • change the docs to show with pytest.warns() (no arguments) as the catch-anything default
  • change the default argument from None to Warning
  • emit a deprecation warning if passed None, and treat it as Warning (for now)

I'm saving this one for the Mentored Sprints - experienced contributors please wait a week or so 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: warningsrelated to the warnings builtin plugintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions