Skip to content

Commit

Permalink
Robustify test_namespace_effective PYTHONPATH. (#5976)
Browse files Browse the repository at this point in the history
The real problem is noted, but this quick fix should bolster against
interpreter cache interpreters pointing off to python binaries that
have no setuptools in their associated site-packages.

Fixes #5972
  • Loading branch information
jsirois authored and illicitonion committed Jun 19, 2018
1 parent 26394df commit efdd46e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ def test_namespace_effective(self):
interpreter_cache = PythonInterpreterCache(python_setup, python_repos)
interpreter = interpreter_cache.select_interpreter_for_targets(targets)

pythonpath = [os.path.join(get_buildroot(), t.target_base) for t in targets]
# We need setuptools to import namespace packages (via pkg_resources), so we prime the
# PYTHONPATH with interpreter extras, which Pants always populates with setuptools and wheel.
# TODO(John Sirois): We really should be emitting setuptools in a
# `synthetic_target_extra_dependencies` override in `ApacheThriftPyGen`:
# https://github.com/pantsbuild/pants/issues/5975
pythonpath = interpreter.extras.values()
pythonpath.extend(os.path.join(get_buildroot(), t.target_base) for t in targets)
for dist in resolve(['thrift=={}'.format(self.get_thrift_version(apache_thrift_gen))],
interpreter=interpreter,
context=python_repos.get_network_context(),
Expand Down

0 comments on commit efdd46e

Please sign in to comment.