From 4829e176c540a926e21f09abb04a8236184be75e Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 17 May 2024 22:36:54 -0400 Subject: [PATCH 1/2] `runtests`: Run pre-commit only on specified files --- tests/runtests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/runtests.py b/tests/runtests.py index 2a4f445af12e..2c9461855349 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -78,12 +78,12 @@ def main() -> None: if folder not in {"stdlib", "stubs"}: parser.error("Only the 'stdlib' and 'stubs' folders are supported.") if not os.path.exists(path): - parser.error(rf"'path' {path} does not exist.") + parser.error(rf"{path=} does not exist.") stubtest_result: subprocess.CompletedProcess[bytes] | None = None pytype_result: subprocess.CompletedProcess[bytes] | None = None print("\nRunning pre-commit...") - pre_commit_result = subprocess.run(["pre-commit", "run", "--all-files"]) + pre_commit_result = subprocess.run(["pre-commit", "run", "--files", *Path(path).rglob("*")]) print("\nRunning check_typeshed_structure.py...") check_structure_result = subprocess.run([sys.executable, "tests/check_typeshed_structure.py"]) From f8ce2421680d6863b0ce72a2df7cbeee395c538a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 18 May 2024 08:07:04 -0400 Subject: [PATCH 2/2] Update tests/runtests.py Co-authored-by: Sebastian Rittau --- tests/runtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/runtests.py b/tests/runtests.py index 2c9461855349..69731265995b 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -78,7 +78,7 @@ def main() -> None: if folder not in {"stdlib", "stubs"}: parser.error("Only the 'stdlib' and 'stubs' folders are supported.") if not os.path.exists(path): - parser.error(rf"{path=} does not exist.") + parser.error(f"{path=} does not exist.") stubtest_result: subprocess.CompletedProcess[bytes] | None = None pytype_result: subprocess.CompletedProcess[bytes] | None = None