astral-sh / astral-sh/ruff

`FBT001` and `PLR0917` - false positive on pytest functions

Open
#7,286 10 comments 2 reactions 0 assignees View on GitHub
rule
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

```py
# test_foo.py
@fixture
def a():
return True

def test_foo(a: bool): # error: FBT001
assert a
```

also happens on hook functions
```py
# conftest.py
def pytest_foo(a: bool): # error: FBT001
...
```

arguments to functions called by pytest are always positional, as they are called by pytest itself so this rule is not an issue.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the FBT001 and PLR0917 checks against the pytest examples in the issue, including test_foo and pytest_foo. Done means pytest-called test and hook functions no longer produce these false positives while the rules still report applicable ordinary functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.