From 057e497d30755f5f33039ef50ff70c84daba8386 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Mar 2025 06:25:29 -0700 Subject: [PATCH] [red-knot] fix red-knot fuzzing (#16675) The red-knot CLI changed since the fuzzer script was added; update it to work with current red-knot CLI. Also add some notes on how to ensure local changes to the fuzzer script are picked up. --- python/py-fuzzer/fuzz.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/py-fuzzer/fuzz.py b/python/py-fuzzer/fuzz.py index 181b69770b..5cbf2b145f 100644 --- a/python/py-fuzzer/fuzz.py +++ b/python/py-fuzzer/fuzz.py @@ -17,6 +17,11 @@ Example invocations of the script using `uv`: using a random selection of seeds, and only print a summary at the end (the `shuf` command is Unix-specific): `uvx --from ./python/py-fuzzer fuzz --bin ruff $(shuf -i 0-1000000 -n 10000) --quiet + +If you make local modifications to this script, you'll need to run the above +with `--reinstall` to get your changes reflected in the uv-cached installed +package. Alternatively, if iterating quickly on changes, you can add +`--with-editable ./python/py-fuzzer`. """ from __future__ import annotations @@ -48,7 +53,7 @@ def redknot_contains_bug(code: str, *, red_knot_executable: Path) -> bool: Path(tempdir, "pyproject.toml").write_text('[project]\n\tname = "fuzz-input"') Path(tempdir, "input.py").write_text(code) completed_process = subprocess.run( - [red_knot_executable, "--current-directory", tempdir], + [red_knot_executable, "check", "--project", tempdir], capture_output=True, text=True, )