Skip to content

Conversation

@CodePapayas
Copy link
Contributor

Type of Changes

Type
🐛 Bug fix

Description

Fix possibly-used-before-assignment false positive when using self.fail() in tests

Closes #10743

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code backport maintenance/4.0.x labels Dec 6, 2025
@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.5 milestone Dec 6, 2025
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.98%. Comparing base (ddbb947) to head (d0236a9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10770   +/-   ##
=======================================
  Coverage   95.98%   95.98%           
=======================================
  Files         176      176           
  Lines       19560    19560           
=======================================
  Hits        18775    18775           
  Misses        785      785           
Files with missing lines Coverage Δ
pylint/checkers/utils.py 96.03% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pierre-Sassoulas Pierre-Sassoulas changed the title Unittest fix Properly detect self.fail() as a terminating node in unittest.TestCase Dec 6, 2025
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Great first issue @CodePapayas, this is going in 4.0.5 :)

@Pierre-Sassoulas Pierre-Sassoulas merged commit c45fef7 into pylint-dev:main Dec 6, 2025
48 checks passed
pylint-backport bot pushed a commit that referenced this pull request Dec 6, 2025
@CodePapayas CodePapayas deleted the unittest-fix branch December 6, 2025 07:33
Pierre-Sassoulas pushed a commit that referenced this pull request Dec 6, 2025
…minating node in ``unittest.TestCase`` (#10771)

Properly detect 'self.fail()' as a terminating node in 'unittest.TestCase' (#10770)

(cherry picked from commit c45fef7)

Co-authored-by: Zachary Wilkins-Olson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport maintenance/4.0.x False Positive 🦟 A message is emitted but nothing is wrong with the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect unittest.fail() calls for assignment warning

2 participants