Skip to content

[flake8-pytest-style] Avoid duplicate PT017 diagnostics - #27918

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
AbhinavMir:fix-pt017-duplicate-diagnostics
Sep 3, 2026
Merged

ntBre merged 2 commits into
astral-sh:mainfrom
AbhinavMir:fix-pt017-duplicate-diagnostics

Conversation

@AbhinavMir

@AbhinavMir AbhinavMir commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #27870

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre August 20, 2026 01:06
@astral-sh-bot

astral-sh-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM !

@ntBre ntBre added the bug Something isn't working label Aug 31, 2026

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! This looks good to me, I just had a minor simplification suggestion to avoid the new flag.

And thanks @Pierre-Sassoulas for the review/ping!

},
current_assert.range(),
);
self.diagnostic_reported = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of adding a new flag, could we just reset self.current_assert to None here? Maybe with a rename to pending_assert or at least a docstring for the field to explain the usage.

@ntBre ntBre changed the title Avoid duplicate PT017 diagnostics [flake8-pytest-style] Avoid duplicate PT017 diagnostics Aug 31, 2026

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

@ntBre
ntBre merged commit 6d6e35d into astral-sh:main Sep 3, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PT017 triggers twice at the same location

3 participants