GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-132396: address `redefinition of unused name` errors in `Lib/test` by picnixz · Pull Request #132397 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented Apr 11, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a duplicated test, namely test_dataclass_derived_generic_from_slotted_base, which I've fixed in #132516.

  • Issue: Lint Lib/test with existing ruff configuration #132396

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
picnixz added 10 commits April 9, 2025 13:08
@picnixz
fix noqa: F811 suppression rule
6e01167
@picnixz
prune valid files from ruff's exclusion list
d3f0433
@picnixz
add noqa: F811 in Lib/test/test_dataclasses/__init__.py
280e6e1
@picnixz
add noqa: F811 in Lib/test/test_descr.py
68186ec
@picnixz
add noqa: F811 in Lib/test/test_enum.py
f8f0198
@picnixz
add noqa: F811 in Lib/test/test_functools.py
8c66a74
@picnixz
add noqa: F811 in Lib/test/test_import/__init__.py
887075f
@picnixz
fix ruff(F811) in Lib/test/test_pkg.py
eeaf2f6
@picnixz
add noqa: F811 in Lib/test/test_with.py
b1374b9
@picnixz
fix ruff(F811) in Lib/test/test_yield_from.py
f1cfd78
@picnixz picnixz added the skip news label Apr 11, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Apr 11, 2025
Lint Lib/test with existing ruff configuration #132396
Closed
@picnixz

picnixz commented Apr 11, 2025

Copy link
Copy Markdown
Member Author

cc @hugovk @AA-Turner: I've left this PR as a draft to avoid mentioning many code owners

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner
AA-Turner reviewed Apr 11, 2025
View reviewed changes

@AA-Turner AA-Turner left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

All of the noqa comments seems like a lot of noise in these test files, and I'm not sure how much benefit we gain?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/.ruff.toml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/.ruff.toml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/.ruff.toml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

All of the noqa comments seems like a lot of noise in these test files

Indeed, but at the same they allowed me to find two tests with the same name. So... unless we just noqa-them globally we wouldn't be able to see future ones (and thus it wouldn't help at all =/)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz and others added 4 commits April 12, 2025 02:09
@picnixz @AA-Turner
Update Lib/test/.ruff.toml
2a09ca0
Co-authored-by: Adam Turner <[email protected]>
@picnixz @AA-Turner
Update Lib/test/.ruff.toml
c816e39
Co-authored-by: Adam Turner <[email protected]>
@picnixz @AA-Turner
Update Lib/test/.ruff.toml
de5edc7
Co-authored-by: Adam Turner <[email protected]>
@picnixz
revert most of noqa: F811 false positive (fixed upstream)
484cfd0
@picnixz

picnixz commented Apr 14, 2025

Copy link
Copy Markdown
Member Author

By bumping the ruff version, it appears that the code that would raise is now correctly marked as "unreachable", so suppression is no more an issue. To minimize the diff I've marked all variables with a single letter as being dummy (that way, we ignore classes of the form class A that are usually dummy classes).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
picnixz marked this pull request as ready for review April 14, 2025 14:35
@picnixz
picnixz requested review from AlexWaygood, brettcannon, ericsnowcurrently, ericvsmith, ethanfurman, hugovk, ncoghlan and warsaw as code owners April 14, 2025 14:35
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 14, 2025
@picnixz

picnixz commented Apr 14, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

To have a cleaner, I'll isolate the test fix for test_dataclass_derived_generic_from_slotted_base which was duplicated.

See #132516. Once it's merged, we can revert the commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
temporary fix
e3acc71
@picnixz picnixz added the DO-NOT-MERGE label Apr 14, 2025
@picnixz
Merge remote-tracking branch 'upstream/main' into lint/tests/ruff-red…
49c6cc7
…ef-unused-names-132396
@picnixz picnixz removed the DO-NOT-MERGE label Apr 14, 2025
@picnixz
picnixz requested review from AA-Turner and removed request for ericvsmith April 14, 2025 15:08
@brettcannon
brettcannon removed their request for review April 14, 2025 17:01
AlexWaygood
AlexWaygood reviewed Apr 15, 2025
View reviewed changes
Comment thread Lib/test/.ruff.toml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
correct false positives
7136417
@picnixz
picnixz requested a review from AlexWaygood April 18, 2025 09:42
@picnixz picnixz changed the title gh-132396: ignore some redefinition of unused name errors in Lib/test gh-132396: address redefinition of unused name errors in Lib/test Apr 18, 2025
AA-Turner
AA-Turner approved these changes Apr 18, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 18, 2025
AlexWaygood
AlexWaygood approved these changes Apr 18, 2025
View reviewed changes

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hugovk
hugovk approved these changes Apr 18, 2025
View reviewed changes
@AA-Turner
AA-Turner merged commit 1d5dc5f into python:main Apr 18, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 18, 2025
@hugovk

hugovk commented Apr 18, 2025

Copy link
Copy Markdown
Member

And backport?

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added the needs backport to 3.13 only security fixes label Apr 18, 2025
@miss-islington-app

miss-islington-app Bot commented Apr 18, 2025

Copy link
Copy Markdown

Thanks @picnixz for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 18, 2025
@picnixz @AA-Turner @miss-islington
pythongh-132396: Resolve 'redefinition of unused name' errors in ``Li…
da99afe
…b/test/`` (pythonGH-132397)

(cherry picked from commit 1d5dc5f)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@bedevere-app

bedevere-app Bot commented Apr 18, 2025

Copy link
Copy Markdown

GH-132699 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Apr 18, 2025
@picnixz
picnixz deleted the lint/tests/ruff-redef-unused-names branch April 18, 2025 18:28
AA-Turner added a commit that referenced this pull request Apr 18, 2025
@miss-islington @picnixz @AA-Turner
[3.13] gh-132396: Resolve 'redefinition of unused name' errors in ``L…
10f37b3
…ib/test/`` (GH-132397) (#132699)

gh-132396: Resolve 'redefinition of unused name' errors in ``Lib/test/`` (GH-132397)
(cherry picked from commit 1d5dc5f)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk approved these changes
@AA-Turner AA-Turner AA-Turner approved these changes
@AlexWaygood AlexWaygood AlexWaygood approved these changes
@ethanfurman ethanfurman Awaiting requested review from ethanfurman ethanfurman is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@picnixz @hugovk @AA-Turner @AlexWaygood
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.