Skip to content

fix(tests): clear VIRTUAL_ENV in venv detection tests (#8620 follow-up) - #10122

Closed
kagura-agent wants to merge 1 commit into
NousResearch:mainfrom
kagura-agent:fix/ci-broken-tests-round2
Closed

fix(tests): clear VIRTUAL_ENV in venv detection tests (#8620 follow-up)#10122
kagura-agent wants to merge 1 commit into
NousResearch:mainfrom
kagura-agent:fix/ci-broken-tests-round2

Conversation

@kagura-agent

Copy link
Copy Markdown
Contributor

Problem

The 4 TestDetectVenvDir fallback tests in test_gateway_service.py fail when run inside any virtualenv (both locally and in CI).

Root Cause

After #10093 added VIRTUAL_ENV env-var detection to _detect_venv_dir(), the tests that exercise the PROJECT_ROOT fallback path break — VIRTUAL_ENV is set in CI's virtualenv, so _detect_venv_dir() returns the real venv dir before reaching the fallback logic each test targets.

Fix

Add monkeypatch.delenv('VIRTUAL_ENV', raising=False) to the 4 affected tests so the PROJECT_ROOT fallback is actually exercised.

Verification

python -m pytest tests/hermes_cli/test_gateway_service.py -q --override-ini='addopts='
# 70 passed

Signed-off-by: Kagura kagura.chen28@gmail.com

 follow-up)

After NousResearch#10093 added VIRTUAL_ENV env-var detection to _detect_venv_dir(),
the 4 TestDetectVenvDir fallback tests break when run inside any
virtualenv — VIRTUAL_ENV short-circuits before reaching the
PROJECT_ROOT fallback path each test targets.

Fix: monkeypatch.delenv('VIRTUAL_ENV', raising=False) in each test
so the fallback logic is actually exercised.

Signed-off-by: Kagura <kagura.chen28@gmail.com>
@kagura-agent

Copy link
Copy Markdown
Contributor Author

CI note: The test job failure is pre-existing on main (see latest main test runs — all failing with the same errors). The 4 tests this PR fixes (TestDetectVenvDir) are now passing — they no longer appear in the failed test list.

@kagura-agent

Copy link
Copy Markdown
Contributor Author

Closing to reduce PR volume. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant