question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to opt out of PytestReturnNotNoneWarning ?

See original GitHub issue

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

https://github.com/astropy/astropy/pull/13892 (we do not want to pin maxversion of pytest if we can help it)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pllimcommented, Oct 25, 2022
1reaction
nicoddemuscommented, Oct 25, 2022

Nope it won’t, that’s why I said “pytest-mpl probably needs to be updated”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference — pytest documentation
Return a new pytest pytest.Config instance from given commandline args. This invokes the pytest bootstrapping code in _pytest.config to create a new pytest....
Read more >
chore(deps): update all dependencies (major) (!151 ... - GitLab
Plugins and users which call [reportinfo()]{.title-ref}, use the first return value and interact with it as a [py.path.local]{.title-ref}, would ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found