Skip to content

Commit 36d6ba0

Browse files
miss-islingtonhugovkAlexWaygoodAA-Turner
authored
[3.12] gh-60283: Check for redefined test names in CI (GH-109161) (#109365)
* gh-60283: Check for redefined test names in CI (GH-109161) (cherry picked from commit 3cb9a8e) Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Adam Turner <[email protected]> * Update exclude list for 3.12 * Explicitly exclude files which failed to lint/parse * Sort to avoid future merge conflicts --------- Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 5b38bde commit 36d6ba0

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# pre-commit
1111
.pre-commit-config.yaml @hugovk @AlexWaygood
12+
.ruff.toml @hugovk @AlexWaygood
1213

1314
# Build system
1415
configure* @erlend-aasland @corona10

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# into the PR branch anyway.
6464
#
6565
# https://github.com/python/core-workflow/issues/373
66-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
66+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6767
fi
6868
6969
# Check if we should run hypothesis tests

.github/workflows/lint.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on: [push, pull_request, workflow_dispatch]
55
permissions:
66
contents: read
77

8+
env:
9+
FORCE_COLOR: 1
10+
RUFF_FORMAT: github
11+
812
concurrency:
913
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1014
cancel-in-progress: true

.pre-commit-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.0.288
4+
hooks:
5+
- id: ruff
6+
name: Run Ruff on Lib/test/
7+
args: [--exit-non-zero-on-fix]
8+
files: ^Lib/test/
9+
210
- repo: https://github.com/pre-commit/pre-commit-hooks
311
rev: v4.4.0
412
hooks:
13+
- id: check-toml
14+
exclude: ^Lib/test/test_tomllib/
515
- id: check-yaml
616
- id: end-of-file-fixer
717
types: [python]

Lib/test/.ruff.toml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
fix = true
2+
select = [
3+
"F811", # Redefinition of unused variable (useful for finding test methods with the same name)
4+
]
5+
extend-exclude = [
6+
# Failed to lint
7+
"badsyntax_pep3120.py",
8+
"encoded_modules/module_iso_8859_1.py",
9+
"encoded_modules/module_koi8_r.py",
10+
# Failed to parse
11+
"badsyntax_3131.py",
12+
"support/socket_helper.py",
13+
"test_fstring.py",
14+
"test_lib2to3/data/bom.py",
15+
"test_lib2to3/data/crlf.py",
16+
"test_lib2to3/data/different_encoding.py",
17+
"test_lib2to3/data/false_encoding.py",
18+
"test_lib2to3/data/py2_test_grammar.py",
19+
# TODO Fix: F811 Redefinition of unused name
20+
"test_buffer.py",
21+
"test_capi/test_misc.py",
22+
"test_capi/test_unicode.py",
23+
"test_ctypes/test_arrays.py",
24+
"test_ctypes/test_functions.py",
25+
"test_dataclasses.py",
26+
"test_descr.py",
27+
"test_enum.py",
28+
"test_functools.py",
29+
"test_genericclass.py",
30+
"test_grammar.py",
31+
"test_import/__init__.py",
32+
"test_keywordonlyarg.py",
33+
"test_lib2to3/data/py3_test_grammar.py",
34+
"test_pkg.py",
35+
"test_subclassinit.py",
36+
"test_tokenize.py",
37+
"test_typing.py",
38+
"test_yield_from.py",
39+
"time_hashlib.py",
40+
# Pending https://github.com/python/cpython/pull/109139
41+
"test_monitoring.py",
42+
]

0 commit comments

Comments
 (0)