Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-12454: Be explicit about which python pytest-xdist uses. #45

Merged
merged 1 commit into from
Nov 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion python/lsst/sconsUtils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,18 @@ def runPythonTests(self, pyList):
njobs = self._env.GetOption("num_jobs")
print("Running pytest with {} process{}".format(njobs, "" if njobs == 1 else "es"))
if njobs > 1:
interpreter = interpreter + " --max-slave-restart=0 -n {}".format(njobs)
# We unambiguously specify the Python interpreter to be used to
# execute tests. This ensures that all pytest-xdist worker
# processes refer to the same Python as the xdist master, and
# hence avoids pollution of ``sys.path`` that can happen when we
# call the same interpreter by different paths (for example, if
# the master process calls ``miniconda/bin/python``, and the
# workers call ``current/bin/python``, the workers will end up
# with site-packages directories corresponding to both locations
# on ``sys.path``, even if the one is a symlink to the other).
executable = os.path.realpath(sys.executable)
interpreter = (interpreter +
" -d --max-slave-restart=0 --tx={}*popen//python={}".format(njobs, executable))

# Remove target so that we always trigger pytest
if os.path.exists(target):
Expand Down