Support relative `--ty-path` in ty-benchmark (#18385)

## Summary

This currently doesn't work because the benchmark changes the working
directory. Also updates the process name to make it easier to compare
two local ty binaries.
This commit is contained in:
Ibraheem Ahmed 2025-05-30 18:19:20 -04:00 committed by GitHub
parent b390b3cb8e
commit aa1fad61e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -59,9 +59,9 @@ class Ty(Tool):
def __init__(self, *, path: Path | None = None): def __init__(self, *, path: Path | None = None):
self.name = str(path) or "ty" self.name = str(path) or "ty"
self.path = path or ( self.path = (
(Path(__file__) / "../../../../../target/release/ty").resolve() path or (Path(__file__) / "../../../../../target/release/ty")
) ).resolve()
assert self.path.is_file(), ( assert self.path.is_file(), (
f"ty not found at '{self.path}'. Run `cargo build --release --bin ty`." f"ty not found at '{self.path}'. Run `cargo build --release --bin ty`."
@ -73,7 +73,7 @@ class Ty(Tool):
command.extend(["--python", str(venv.path)]) command.extend(["--python", str(venv.path)])
return Command( return Command(
name="ty", name=self.name,
command=command, command=command,
) )