From f31c29344ba896c830937cffc19eb7ddd5e78300 Mon Sep 17 00:00:00 2001 From: John Sirois Date: Tue, 19 Jun 2018 22:14:15 -0600 Subject: [PATCH] Fix TestSetupPyInterpreter.test_setuptools_version Previously the test failed to populate the `PythonInterpreter` data product leading to a fallback to the current non-bare interpreter which allowed `setuptools` from `site-packages` to leak in. Fixes #5467 --- .../python/pants_test/backend/python/tasks/test_setup_py.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/python/pants_test/backend/python/tasks/test_setup_py.py b/tests/python/pants_test/backend/python/tasks/test_setup_py.py index 41b9a8b8cd4..335bef29118 100644 --- a/tests/python/pants_test/backend/python/tasks/test_setup_py.py +++ b/tests/python/pants_test/backend/python/tasks/test_setup_py.py @@ -16,6 +16,7 @@ from twitter.common.dirutil.chroot import Chroot from pants.backend.python.subsystems.python_setup import PythonSetup +from pants.backend.python.tasks.select_interpreter import SelectInterpreter from pants.backend.python.tasks.setup_py import SetupPy from pants.base.exceptions import TaskError from pants.build_graph.build_file_aliases import BuildFileAliases @@ -43,7 +44,9 @@ def setUp(self): @contextmanager def run_execute(self, target, recursive=False): self.set_options(recursive=recursive) - context = self.context(target_roots=[target]) + si_task_type = self.synthesize_task_subtype(SelectInterpreter, 'si_scope') + context = self.context(for_task_types=[si_task_type], target_roots=[target]) + si_task_type(context, os.path.join(self.pants_workdir, 'si')).execute() setup_py = self.create_task(context) setup_py.execute() yield context.products.get_data(SetupPy.PYTHON_DISTS_PRODUCT)