Skip to content

Is there a way to opt out of PytestReturnNotNoneWarning ? #10427

Description

@pllim

As of pytest 7.2.0 , any test function that returns something not a None now gets a PytestReturnNotNoneWarning. Looking at its memo in https://github.com/pytest-dev/pytest/blob/main/doc/en/deprecations.rst , I do not see a way to tell pytest, "It's okay, this return is intentional, just let it return stuff and not emit the warning."

How do I opt out of this warning?

What's the problem this feature will solve?

This will let me keep using https://github.com/matplotlib/pytest-mpl plugin because it requires returning the Matplotlib figure object for image comparison.

Describe the solution you'd like

Let me opt out.

Alternative Solutions

Tell https://github.com/matplotlib/pytest-mpl devs how to rework their plugin to not return stuff.

Additional context

astropy/astropy#13892 (we do not want to pin maxversion of pytest if we can help it)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions