WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

[false-positive][PT019] When I have a test with an underscored parameter name, it incorrectly suggests switching to usefixtures #276

@webknjaz

Description

@webknjaz

Bug report

What's wrong

I get

PT019 fixture _set without value is injected as parameter, use @pytest.mark.usefixtures instead

with

...
    @pytest.mark.parametrize(("_set", "expected"), (({"key2"}, True), ({"key"}, False)))
    def test_isdisjoint(
        self, cls: Type[MutableMultiMapping[str]], _set: Set[str], expected: bool
    ) -> None:
        ...

How it should work

PT019 shouldn't be triggered. Replacing _set with x_set works, so the plugin incorrectly assumes that there's no value provided for _set while it is, and incorrectly suggests using @pytest.mark.usefixtures, which would make it impossible to provide it with a value.

System information

  • Operating system: Gentoo/Linux
  • Python version: 3.11.5
  • flake8 version: 6.1.0
  • flake8-pytest-style version: flake8-pytest-style ~= 1.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions