Repository navigation
chore(ci): run the activation scripts in sh, dash, bash, zsh and fish - #397
Merged
Merged
Conversation
pytest turns any failure raised inside an xfail-marked test into an expected failure, so pytest.fail() from _binary() was indistinguishable from the known zsh and fish bugs and NODEENV_REQUIRE_SHELLS=1 could not keep the job red. Check the shells once at import instead.
run() and _fish_prompt_output() built the same subprocess call, and neither set cwd, so the shells ran in the git work tree: fish's stock prompt appends the vcs ref, and relative paths resolved against the checkout. Both now go through _launch(), which runs in env.home. The dumper also prints a sentinel first, so stray output from an activation script gives a readable assertion instead of a bare ValueError from the key=value parser.
Only the first two entries were checked, and the deactivation test compares against the wholesale-restored _OLD_NODE_VIRTUAL_PATH, so nothing an activation script appended to PATH was observable. Compare the activated PATH against the unactivated one with the two environment entries prepended.
NODE_VIRTUAL_ENV_DISABLE_PROMPT disables exactly what test_prompt_override asserts, so a developer who exports it saw the prompt tests fail; BASH_ENV lets `bash -c` source arbitrary setup.
The FISH_NODE_PATH_CLOBBER reason named NODE_PATH only, although the same nondestructive pass leaves NPM_CONFIG_PREFIX and npm_config_prefix unrestored as well. The NODE_PATH comment described the post-fix behaviour, not today's.
Match the "Added ..." wording the other unreleased entries use.
CI proved the whole-PATH assertion right: fish 3.0 turned on stderr-nocaret, so the `^/dev/null` at the end of the PATH line in activate.fish is no longer a redirect and ends up in PATH as a literal entry. Marked like the other two known nodeenv bugs; the fix goes on its own branch.
pytestmark is applied after the module is imported, so the NODEENV_REQUIRE_SHELLS guard would abort collection on Windows before the POSIX-only skip could take effect. Also reworded the _launch docstring: every path handed to the shells is absolute, so pinning cwd buys determinism and keeps fish's vcs prompt out, not relative path resolution.
This was referenced Sep 17, 2026
Owner
Author
|
Filed the three bugs this branch found, so the
Each gets its own |
ekalinin
added a commit
that referenced
this pull request
Sep 18, 2026
#397 added activate-shells and this branch added integration; git saw overlapping adds in the same gap of tests.yml and interleaved them into one job. Both are kept, each with its own steps and command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The generated activation scripts are never executed by any test or CI job.
tests/test_install_activate.pycompares the generated text against thetemplates in
nodeenv.py; the only exception istest_isolate_npm_sh_sets_and_restores, which runssh -c '. activate && ...'.zsh and fish are never run at all.
b042056("fix(nodeenv): guard fish npm config restore") is what that costs:a logic error in
activate.fishthat text assertions cannot catch.What this adds
tests/test_activate_shells.pyactually runs the generated scripts insh,dash,bash,zshandfish, and asserts on the environment they produce:activation sets
PATH/NODE_PATH/NPM_CONFIG_PREFIX, deactivationrestores it, repeated cycles do not grow
PATH,--isolate-npmround-trips,and the prompt override applies and is undone.
A table of
Shellobjects is the only place that knows per-shell syntax.Rather than echoing variables inside each shell, the harness sources the
script and then execs a small Python dumper as a child process, so exported
values come back normalised - fish stores
PATHas a list but exports itcolon-joined. The environment is a stub built in
tmpdirwith a fakebin/node: no network, no Node.js download. The whole job runs in under fourseconds.
A new
activate-shellsjob onubuntu-latestinstalls zsh and fish and runsthe module with
NODEENV_REQUIRE_SHELLS=1, which turns a missing shell into ahard failure instead of a silent skip. Without it the job would go green if
apt-getquietly failed, and the check would be theatre. Locally, a shell youdo not have installed is simply skipped.
Three bugs this found
Each is marked
xfail(strict=True), so the marker must be removed when thebug is fixed or the suite fails. Fixes go on their own branches, one concern
per branch.
zsh cannot source
bin/activate.68abdc3(FEAT: Check if activate is called as script. #384) addedcase $0 in */bin/activate ) ... exit 1. zsh sets$0to the sourcedfile's path (
FUNCTION_ARGZERO), so the guard fires onsource env/bin/activateand activation aborts withrc=1. Confirmed bydisarming the guard: all ten marked zsh parameters flip to
XPASS(strict).activate.fisherases a pre-existingNODE_PATH. Thedeactivate_node nondestructivepass near the top runs before theactivation code saves
_OLD_NODE_PATH, and theNODE_PATHbranch ofdeactivate_nodehas noif set -q NODE_VIRTUAL_ENVguard, so itselsearm does
set -e NODE_PATH.b042056added that guard for the npmvariables only;
NPM_CONFIG_PREFIXandnpm_config_prefixhave the sameproblem, currently masked by assertion order.
activate.fishleaves a literal^/dev/nullinPATH. fish 3.0turned on
stderr-nocaret, so the trailing^/dev/nullon thePATHlineis no longer a redirect and lands in
PATHas an entry. The same line'scomment is also defeated: the warning it meant to suppress now reaches
stderr.
Scope
Tests and CI only.
nodeenv.pyis not modified. Windows scripts(
activate.bat,Activate.ps1) and macOS runners are out of scope and canfollow separately.
Verification
activate-shellson CI:46 passed, 14 xfailed, zero skipped - all fiveshells really ran. Full matrix green on ubuntu, macOS and Windows.