Skip to content

Underscores are unnecessary in pytest fixtures#12

Merged
thatch merged 2 commits into
mainfrom
thatch/pytest-fixture-names
Apr 13, 2026
Merged

Underscores are unnecessary in pytest fixtures#12
thatch merged 2 commits into
mainfrom
thatch/pytest-fixture-names

Conversation

@thatch
Copy link
Copy Markdown
Member

@thatch thatch commented Apr 13, 2026

No description provided.

thatch and others added 2 commits April 13, 2026 09:19
Flags underscore-prefixed pytest fixture functions — the leading underscore
is unnecessary and misleading in test code since fixtures are never truly
"private" or "unused".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread pytest/fixture_names.py
return True
# @fixture or @fx
if isinstance(decorator, ast.Name) and decorator.id in self.fixture_aliases:
return True
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you can return isinstance(...) and ...

@thatch thatch merged commit 91519ee into main Apr 13, 2026
6 checks passed
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 this pull request may close these issues.

2 participants