From c0dff40e3a9cf3ce50e4fd06222f47820e403d82 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 20 Jul 2026 08:59:23 -0700 Subject: [PATCH] test: use shutil.copy2 instead of os.link for cross-device tmp fixtures TestPtyWebSocket's two python-resolution tests and the sibling fixture in test_tui_resume_flow.py hard-linked sys.executable into pytest's tmp_path. On machines where /tmp is a different filesystem than the venv (tmpfs vs disk home) os.link raises OSError EXDEV and the tests fail before reaching any assertion. copy2 preserves the executable bit and works across devices. --- tests/hermes_cli/test_tui_resume_flow.py | 6 +++++- tests/hermes_cli/test_web_server.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/hermes_cli/test_tui_resume_flow.py b/tests/hermes_cli/test_tui_resume_flow.py index d30b1bb7c838..4bcd3a6119fd 100644 --- a/tests/hermes_cli/test_tui_resume_flow.py +++ b/tests/hermes_cli/test_tui_resume_flow.py @@ -1684,7 +1684,11 @@ def test_launch_tui_worktree_validates_relative_python_against_final_cwd( relative_python = Path(".review-venv") / "bin" / Path(sys.executable).name python_path = worktree / relative_python python_path.parent.mkdir(parents=True) - os.link(sys.executable, python_path) + # copy2, not os.link: tmp_path may sit on a different filesystem than + # the venv (tmpfs /tmp vs disk home) where hard links raise EXDEV. + import shutil + + shutil.copy2(sys.executable, python_path) captured = {} monkeypatch.setenv("HERMES_CWD", str(parent_cwd)) diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py index 24afb5ec9bd3..404a06ae8b84 100644 --- a/tests/hermes_cli/test_web_server.py +++ b/tests/hermes_cli/test_web_server.py @@ -8430,7 +8430,9 @@ class TestPtyWebSocket: relative_python = Path(".review-venv") / "bin" / Path(sys.executable).name python_path = tmp_path / relative_python python_path.parent.mkdir(parents=True) - os.link(sys.executable, python_path) + # copy2, not os.link: tmp_path may sit on a different filesystem than + # the venv (tmpfs /tmp vs disk home) where hard links raise EXDEV. + shutil.copy2(sys.executable, python_path) monkeypatch.setenv("HERMES_CWD", str(tmp_path)) monkeypatch.setenv("HERMES_PYTHON", str(relative_python)) monkeypatch.setattr( @@ -8452,7 +8454,9 @@ class TestPtyWebSocket: bin_dir = tmp_path / "bin" bin_dir.mkdir() executable = bin_dir / command - os.link(sys.executable, executable) + # copy2, not os.link: tmp_path may sit on a different filesystem than + # the venv (tmpfs /tmp vs disk home) where hard links raise EXDEV. + shutil.copy2(sys.executable, executable) env = { "HERMES_CWD": str(tmp_path), "HERMES_PYTHON": command,