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

False positive PT019 with monkey patching and _ in test signature #213

Closed
jamesbraza opened this issue Feb 5, 2023 · 2 comments
Closed
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@jamesbraza
Copy link

Bug report

What's wrong

from unittest.mock import patch


@patch("time.sleep")
def test_foo(_) -> None:
    _ = 0

Running flake8-pytest-style==1.6.0 on this, it reports:

a.py:5:1: PT019 fixture _ without value is injected as parameter, use @pytest.mark.usefixtures instead

How it should work

I think this should not be getting PT019, as I:

  • Am required to have something in the signature for the patched MagicMock
  • But I don't plan on using it, so I named it _
  • Don't have a fixture _ declared in the module

System information

  • Operating system: macOS Monterey version 12.6
  • Python version: 3.10.9
  • flake8 version: 6.0.0
  • flake8-pytest-style version: 1.6.0
@jamesbraza jamesbraza added the bug Something isn't working label Feb 5, 2023
@jamesbraza
Copy link
Author

Actually, I believe this is a dup of #202, so if you want to close this as a duplicate, feel free.

@m-burst
Copy link
Owner

m-burst commented Feb 7, 2023

Yes, this is a dup of #202

@m-burst m-burst closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
@m-burst m-burst added the duplicate This issue or pull request already exists label Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants