mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
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.
This commit is contained in:
parent
faa4cec01b
commit
c0dff40e3a
2 changed files with 11 additions and 3 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue