mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 13:15:06 +00:00
py-fuzzer: allow relative executable paths (#18915)
## Summary I tried running `py-fuzzer` using executables in the current working directory, but that failed with: ``` ▶ uvx --from ./python/py-fuzzer --reinstall fuzz --test-executable ./ty_feature --bin=ty --baseline-executable ./ty_main --only-new-bugs 0-500 Usage: fuzz [-h] [--only-new-bugs] [--quiet] [--test-executable TEST_EXECUTABLE] [--baseline-executable BASELINE_EXECUTABLE] --bin {ruff,ty} seeds [seeds ...] fuzz: error: Bad argument passed to `--baseline-executable`: no such file or executable PosixPath('ty_main') "Bad argument passed to `--baseline-executable`: no such file or executable PosixPath('ty_main')" ``` Using `.absolute()` on the `Path` fixes this. ## Test Plan Successful `py-fuzzer` run with the invocation above.
This commit is contained in:
parent
833be2e66a
commit
0edbd6c390
1 changed files with 6 additions and 2 deletions
|
@ -268,6 +268,10 @@ def run_fuzzer(args: ResolvedCliArgs) -> ExitCode:
|
|||
return ExitCode(0)
|
||||
|
||||
|
||||
def absolute_path(p: str) -> Path:
|
||||
return Path(p).absolute()
|
||||
|
||||
|
||||
def parse_seed_argument(arg: str) -> int | range:
|
||||
"""Helper for argument parsing"""
|
||||
if "-" in arg:
|
||||
|
@ -337,7 +341,7 @@ def parse_args() -> ResolvedCliArgs:
|
|||
"Executable to test. "
|
||||
"Defaults to a fresh build of the currently checked-out branch."
|
||||
),
|
||||
type=Path,
|
||||
type=absolute_path,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--baseline-executable",
|
||||
|
@ -346,7 +350,7 @@ def parse_args() -> ResolvedCliArgs:
|
|||
"Defaults to whatever version is installed "
|
||||
"in the Python environment."
|
||||
),
|
||||
type=Path,
|
||||
type=absolute_path,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--bin",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue