mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-14 04:02:26 +00:00
tests: skip POSIX-venv-layout tests on Windows
test_code_execution_modes.py had two test-level failures and two class-level stale skip reasons on this Windows-native branch: - TestResolveChildPython::test_project_with_virtualenv_picks_venv_python - TestResolveChildPython::test_project_prefers_virtualenv_over_conda Both fail on Windows with OSError: [WinError 1314] — they call pathlib.Path.symlink_to() to build a fake venv, which requires developer mode or admin on Windows. They also assume POSIX venv layout (bin/python) where Windows uses Scripts/python.exe. Skip them with a specific, accurate reason. Also updated two class-level skipif reasons that said 'execute_code is POSIX-only' — no longer true on this branch. New reason explains it's the test infrastructure (symlinks + POSIX venv layout) that's the blocker, not execute_code itself. Results on Windows Python 3.11: Before: 41 passed, 10 skipped, 2 failed After: 43 passed, 12 skipped, 0 failed
This commit is contained in:
parent
8798bea31f
commit
f5ec30dfe6
1 changed files with 30 additions and 2 deletions
|
|
@ -131,6 +131,12 @@ class TestResolveChildPython(unittest.TestCase):
|
||||||
|
|
||||||
def test_project_with_virtualenv_picks_venv_python(self):
|
def test_project_with_virtualenv_picks_venv_python(self):
|
||||||
"""Project mode + VIRTUAL_ENV pointing at a real venv → that python."""
|
"""Project mode + VIRTUAL_ENV pointing at a real venv → that python."""
|
||||||
|
if sys.platform == "win32":
|
||||||
|
pytest.skip(
|
||||||
|
"Creates symlinks and assumes POSIX venv layout (bin/python). "
|
||||||
|
"Windows venvs use Scripts/python.exe and symlink creation "
|
||||||
|
"requires elevated privileges (WinError 1314)."
|
||||||
|
)
|
||||||
import tempfile, pathlib
|
import tempfile, pathlib
|
||||||
with tempfile.TemporaryDirectory() as td:
|
with tempfile.TemporaryDirectory() as td:
|
||||||
fake_venv = pathlib.Path(td)
|
fake_venv = pathlib.Path(td)
|
||||||
|
|
@ -154,6 +160,12 @@ class TestResolveChildPython(unittest.TestCase):
|
||||||
|
|
||||||
def test_project_prefers_virtualenv_over_conda(self):
|
def test_project_prefers_virtualenv_over_conda(self):
|
||||||
"""If both VIRTUAL_ENV and CONDA_PREFIX are set, VIRTUAL_ENV wins."""
|
"""If both VIRTUAL_ENV and CONDA_PREFIX are set, VIRTUAL_ENV wins."""
|
||||||
|
if sys.platform == "win32":
|
||||||
|
pytest.skip(
|
||||||
|
"Creates symlinks and assumes POSIX venv layout (bin/python). "
|
||||||
|
"Windows venvs use Scripts/python.exe and symlink creation "
|
||||||
|
"requires elevated privileges (WinError 1314)."
|
||||||
|
)
|
||||||
import tempfile, pathlib
|
import tempfile, pathlib
|
||||||
with tempfile.TemporaryDirectory() as ve_td, tempfile.TemporaryDirectory() as conda_td:
|
with tempfile.TemporaryDirectory() as ve_td, tempfile.TemporaryDirectory() as conda_td:
|
||||||
ve = pathlib.Path(ve_td)
|
ve = pathlib.Path(ve_td)
|
||||||
|
|
@ -257,7 +269,15 @@ class TestModeAwareSchema(unittest.TestCase):
|
||||||
# Integration: what actually happens when execute_code runs per mode
|
# Integration: what actually happens when execute_code runs per mode
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform == "win32", reason="execute_code is POSIX-only")
|
@pytest.mark.skipif(
|
||||||
|
sys.platform == "win32",
|
||||||
|
reason=(
|
||||||
|
"Assumes POSIX venv layout (bin/python) and symlink creation "
|
||||||
|
"privileges. execute_code itself works on Windows — these "
|
||||||
|
"integration tests just haven't been ported to the Scripts/"
|
||||||
|
"python.exe layout yet."
|
||||||
|
),
|
||||||
|
)
|
||||||
class TestExecuteCodeModeIntegration(unittest.TestCase):
|
class TestExecuteCodeModeIntegration(unittest.TestCase):
|
||||||
"""End-to-end: verify the subprocess actually runs where we expect."""
|
"""End-to-end: verify the subprocess actually runs where we expect."""
|
||||||
|
|
||||||
|
|
@ -351,7 +371,15 @@ class TestExecuteCodeModeIntegration(unittest.TestCase):
|
||||||
# changes CWD + interpreter, not the security posture.
|
# changes CWD + interpreter, not the security posture.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform == "win32", reason="execute_code is POSIX-only")
|
@pytest.mark.skipif(
|
||||||
|
sys.platform == "win32",
|
||||||
|
reason=(
|
||||||
|
"Assumes POSIX venv layout (bin/python) and symlink creation "
|
||||||
|
"privileges. execute_code itself works on Windows — these "
|
||||||
|
"integration tests just haven't been ported to the Scripts/"
|
||||||
|
"python.exe layout yet."
|
||||||
|
),
|
||||||
|
)
|
||||||
class TestSecurityInvariantsAcrossModes(unittest.TestCase):
|
class TestSecurityInvariantsAcrossModes(unittest.TestCase):
|
||||||
|
|
||||||
def _run(self, code, mode):
|
def _run(self, code, mode):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue