Include PYTHONPATH in get_env_with_venv_bin
for use in subprocesses
#4052
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.
Fixes #4051
The test
tests.cmdline.commands.test_process:test_pause_play_kill
was failing in local setups with a time out. The problem was that the
daemon, launched as a subprocess in the
setUp
, would fail to load thesubmitted process, because the class could not be imported. This is
because it is defined in the
tests.utils
module, which would not bepart of the Python path of the subprocess.
The
tests
module is automatically added to the path bypytest
,however, it was not being forwarded to the subprocess. Passing the
current environment through the
env
argument solves this. The onlyadditional change is to include the
PYTHONPATH
variable in the envcopy created by
aiida.cmdline.utils.common.get_env_with_venv_bin
.These two changes guarantee that the test process classes are importable
by the daemon that is running in the subprocess.