You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests/web/test_build.py::test_main_without_npm fails on machines with npm in the fallback dirs #36
The test monkeypatches shutil.which to return None and asserts main() == 1 with "npm not found" on stderr. Since the Node.js fallback detection landed (commit 4993483), main() also probes _NODE_FALLBACK_DIRS (src/profiles/web/build.py:16-21) — on machines where /opt/homebrew/bin/npm (macOS) or /usr/local/bin/npm (Linux) exists, npm is found anyway and main() returns 0.
So the test is environment-dependent: it only passes on machines with no npm in the hardcoded fallback locations, and is currently red on this repo's own dev machine.
Fix
In the test, also monkeypatch _NODE_FALLBACK_DIRS to point at an empty temp dir (or make the discovery roots a parameter of main()).
While there: the final monkeypatch.setattr(shutil, "which", original_which) is redundant (pytest undoes monkeypatches) — remove it.
Activity