mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	[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 3cb9a8edca)
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>
* 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 <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>
			
			
This commit is contained in:
		
							parent
							
								
									5b38bdeaf1
								
							
						
					
					
						commit
						36d6ba08d0
					
				
					 5 changed files with 58 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								.github/CODEOWNERS
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/CODEOWNERS
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# pre-commit
 | 
					# pre-commit
 | 
				
			||||||
.pre-commit-config.yaml       @hugovk @AlexWaygood
 | 
					.pre-commit-config.yaml       @hugovk @AlexWaygood
 | 
				
			||||||
 | 
					.ruff.toml                    @hugovk @AlexWaygood
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build system
 | 
					# Build system
 | 
				
			||||||
configure*                    @erlend-aasland @corona10
 | 
					configure*                    @erlend-aasland @corona10
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								.github/workflows/build.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -63,7 +63,7 @@ jobs:
 | 
				
			||||||
            # into the PR branch anyway.
 | 
					            # into the PR branch anyway.
 | 
				
			||||||
            #
 | 
					            #
 | 
				
			||||||
            # https://github.com/python/core-workflow/issues/373
 | 
					            # https://github.com/python/core-workflow/issues/373
 | 
				
			||||||
            git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
 | 
					            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
 | 
				
			||||||
          fi
 | 
					          fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          # Check if we should run hypothesis tests
 | 
					          # Check if we should run hypothesis tests
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								.github/workflows/lint.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/lint.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -5,6 +5,10 @@ on: [push, pull_request, workflow_dispatch]
 | 
				
			||||||
permissions:
 | 
					permissions:
 | 
				
			||||||
  contents: read
 | 
					  contents: read
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  FORCE_COLOR: 1
 | 
				
			||||||
 | 
					  RUFF_FORMAT: github
 | 
				
			||||||
 | 
					
 | 
				
			||||||
concurrency:
 | 
					concurrency:
 | 
				
			||||||
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
 | 
					  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
 | 
				
			||||||
  cancel-in-progress: true
 | 
					  cancel-in-progress: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,17 @@
 | 
				
			||||||
repos:
 | 
					repos:
 | 
				
			||||||
 | 
					  - repo: https://github.com/astral-sh/ruff-pre-commit
 | 
				
			||||||
 | 
					    rev: v0.0.288
 | 
				
			||||||
 | 
					    hooks:
 | 
				
			||||||
 | 
					      - id: ruff
 | 
				
			||||||
 | 
					        name: Run Ruff on Lib/test/
 | 
				
			||||||
 | 
					        args: [--exit-non-zero-on-fix]
 | 
				
			||||||
 | 
					        files: ^Lib/test/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - repo: https://github.com/pre-commit/pre-commit-hooks
 | 
					  - repo: https://github.com/pre-commit/pre-commit-hooks
 | 
				
			||||||
    rev: v4.4.0
 | 
					    rev: v4.4.0
 | 
				
			||||||
    hooks:
 | 
					    hooks:
 | 
				
			||||||
 | 
					      - id: check-toml
 | 
				
			||||||
 | 
					        exclude: ^Lib/test/test_tomllib/
 | 
				
			||||||
      - id: check-yaml
 | 
					      - id: check-yaml
 | 
				
			||||||
      - id: end-of-file-fixer
 | 
					      - id: end-of-file-fixer
 | 
				
			||||||
        types: [python]
 | 
					        types: [python]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										42
									
								
								Lib/test/.ruff.toml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Lib/test/.ruff.toml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,42 @@
 | 
				
			||||||
 | 
					fix = true
 | 
				
			||||||
 | 
					select = [
 | 
				
			||||||
 | 
					    "F811",  # Redefinition of unused variable (useful for finding test methods with the same name)
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					extend-exclude = [
 | 
				
			||||||
 | 
					    # Failed to lint
 | 
				
			||||||
 | 
					    "badsyntax_pep3120.py",
 | 
				
			||||||
 | 
					    "encoded_modules/module_iso_8859_1.py",
 | 
				
			||||||
 | 
					    "encoded_modules/module_koi8_r.py",
 | 
				
			||||||
 | 
					    # Failed to parse
 | 
				
			||||||
 | 
					    "badsyntax_3131.py",
 | 
				
			||||||
 | 
					    "support/socket_helper.py",
 | 
				
			||||||
 | 
					    "test_fstring.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/bom.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/crlf.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/different_encoding.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/false_encoding.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/py2_test_grammar.py",
 | 
				
			||||||
 | 
					    # TODO Fix: F811 Redefinition of unused name
 | 
				
			||||||
 | 
					    "test_buffer.py",
 | 
				
			||||||
 | 
					    "test_capi/test_misc.py",
 | 
				
			||||||
 | 
					    "test_capi/test_unicode.py",
 | 
				
			||||||
 | 
					    "test_ctypes/test_arrays.py",
 | 
				
			||||||
 | 
					    "test_ctypes/test_functions.py",
 | 
				
			||||||
 | 
					    "test_dataclasses.py",
 | 
				
			||||||
 | 
					    "test_descr.py",
 | 
				
			||||||
 | 
					    "test_enum.py",
 | 
				
			||||||
 | 
					    "test_functools.py",
 | 
				
			||||||
 | 
					    "test_genericclass.py",
 | 
				
			||||||
 | 
					    "test_grammar.py",
 | 
				
			||||||
 | 
					    "test_import/__init__.py",
 | 
				
			||||||
 | 
					    "test_keywordonlyarg.py",
 | 
				
			||||||
 | 
					    "test_lib2to3/data/py3_test_grammar.py",
 | 
				
			||||||
 | 
					    "test_pkg.py",
 | 
				
			||||||
 | 
					    "test_subclassinit.py",
 | 
				
			||||||
 | 
					    "test_tokenize.py",
 | 
				
			||||||
 | 
					    "test_typing.py",
 | 
				
			||||||
 | 
					    "test_yield_from.py",
 | 
				
			||||||
 | 
					    "time_hashlib.py",
 | 
				
			||||||
 | 
					    # Pending https://github.com/python/cpython/pull/109139
 | 
				
			||||||
 | 
					    "test_monitoring.py",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue