tests: two parity-runner tests pass on macOS
OracleReuseTests ran the shim through `#!/usr/bin/env python3` with a PATH whose Python folder is Homebrew's, which names it only python3.13: the shim wasn't found (127). The test now gives that PATH a python3 of its own. test_report_rejects_sources_changed_during_a_run compared a resolved source path with an unresolved temp root, and macOS's /var is /private/var. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -259,7 +259,11 @@ class OracleReuseTests(unittest.TestCase):
|
||||
self.input, self.output = root / "work" / "in.txt", root / "work" / "out.txt"
|
||||
self.input.parent.mkdir()
|
||||
self.input.write_text("a")
|
||||
python = Path(sys.executable).parent
|
||||
# The shim starts with `#!/usr/bin/env python3`, and a Python's own folder may name it only
|
||||
# python3.13 (Homebrew's): a python3 of its own keeps the PATH below enough.
|
||||
python = root / "python"
|
||||
python.mkdir()
|
||||
(python / "python3").symlink_to(sys.executable)
|
||||
self.env = dict(os.environ, PATH=f"{self.shim}:{self.bin}:{python}", PARITY_SHIM_REAL_PATH=str(self.bin),
|
||||
PARITY_SHIM_CACHE=str(root / "cache"))
|
||||
self.subprocess = subprocess
|
||||
|
||||
@@ -10,7 +10,9 @@ from tools import test_rust_parity as parity
|
||||
class ParityRunnerTests(unittest.TestCase):
|
||||
def test_report_rejects_sources_changed_during_a_run(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp)
|
||||
# Resolved, as source_hashes resolves the sources: macOS's temp folder is a symlink
|
||||
# (/var -> /private/var).
|
||||
root = Path(temp).resolve()
|
||||
source = root / "source.rs"
|
||||
source.write_text("before")
|
||||
with mock.patch.object(parity.lab, "ROOT", root):
|
||||
|
||||
Reference in New Issue
Block a user