Skip to content

[3.12] gh-60283: Check for redefined test names in CI (GH-109161) #109365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 14, 2023

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 13, 2023

(cherry picked from commit 3cb9a8e)

Co-authored-by: Hugo van Kemenade hugovk@users.noreply.github.com
Co-authored-by: Alex Waygood Alex.Waygood@Gmail.com
Co-authored-by: Adam Turner 9087854+AA-Turner@users.noreply.github.com

(cherry picked from commit 3cb9a8e)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@Yhg1s
Copy link
Member

Yhg1s commented Sep 13, 2023

The PR description doesn't seem accurate. Is this really a good idea for 3.12 (3.12.0 rc3 or 3.12.1)? Do we have a good handle on potential fallout from adding this workflow? Is the benefit of running on 3.12 worth the potential disruption?

@AlexWaygood
Copy link
Member

AlexWaygood commented Sep 13, 2023

My opinion: I don't think it's crucial at all that this gets into 3.12.0; I'd certainly be fine with it being delayed until 3.12.1. However, I don't see it as a particularly risky change, so I also don't think there'd be any harm in it going into 3.12.0.

What this PR does

It adds a workflow that runs ruff in CI on Lib/test/. Only a single ruff rule is enabled, F811. The rule flags names that appear to be redefined before being used in the same scope. In my experience, the number of false positives from F811 is very low, so I think there's very low risk of disruption.

Why adding this CI check is useful

This is useful for CPython, in that it means that the rule detects unittest.TestCase subclasses where two or more test methods have the same name. This is an issue that's cropped up repeatedly for CPython, where we don't realise that tests are being silently skipped, because they're being overridden before they're ever being run.

Why I think it's good to backport this PR to 3.12 (but not necessarily 3.12.0)

We've had lots of situations in the past where core developers have been pretty confused due to CI setups being subtly different between the main branch and the various bugfix branches. Where possible, and where it's low-risk to do so, I think it's generally useful to keep the branches in sync on this kind of thing.

@Yhg1s Yhg1s merged commit 36d6ba0 into python:3.12 Sep 14, 2023
@miss-islington miss-islington deleted the backport-3cb9a8e-3.12 branch September 14, 2023 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants