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

FBT003 and pytest.param #4172

Closed
jamesbraza opened this issue May 1, 2023 · 1 comment · Fixed by #4176
Closed

FBT003 and pytest.param #4172

jamesbraza opened this issue May 1, 2023 · 1 comment · Fixed by #4176
Assignees

Comments

@jamesbraza
Copy link
Contributor

pytest.param is designed for pytest.mark.parametrize.

import pytest

@pytest.mark.parametrize(
    ("arg1", "arg2"),
    [pytest.param("spam", False), pytest.param("ham", True)],
)
def test_foo(arg1: str, arg2: bool) -> None:  # noqa: FBT001
    pass

Running ruff==0.0.263 on this:

a.py:5:27: FBT003 Boolean positional value in function call
a.py:5:55: FBT003 Boolean positional value in function call

Running flake8==6.0.0 with flake8-boolean-trap==1.0.0 on this, there is no output. Somehow, ruff seems to have a more comprehensive FBT003 checker.

pytest.param doesn't support kwargs, so one has to use boolean positionals. Any thoughts on filtering out FBT003 for pytest.param?

@charliermarsh
Copy link
Member

I don't mind filtering it out, I think we already have an allowlist for these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants