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

PT019 pytest-fixture-param-without-value False positive when using patch #11463

Open
augustelalande opened this issue May 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@augustelalande
Copy link
Contributor

augustelalande commented May 18, 2024

This presumably applies to any test function with an unused argument, which is not actually a test fixture. But I'm specifically in the situation bellow.

from unittest.mock import Mock, patch

@patch("package.something")
def test_something(_mock: Mock):
    ...

I am using pytest, but also using unittest.mock.patch to modify the behaviour of my test target. The patch decorator returns the mocked object as an argument so I have to accept it, even though I don't use it. PT019 then assumes I'm receiving an unused fixture, and suggests a fix that doesn't work.

@charliermarsh charliermarsh added the bug Something isn't working label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants