Skip to content

Commit

Permalink
Use global instance of PythonSetup for resolve requirements task base (
Browse files Browse the repository at this point in the history
…#7672)

* Use global PythonSetup instance in resolve_requirements task base to ensure cross-cutting global options make it to their relevant tasks

* Update tests to test with proper option scoping for global python-setup
  • Loading branch information
CMLivingston committed May 9, 2019
1 parent 3742edb commit 87e7d2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -37,8 +37,8 @@ class ResolveRequirementsTaskBase(Task):
def subsystem_dependencies(cls):
return super(ResolveRequirementsTaskBase, cls).subsystem_dependencies() + (
PexBuilderWrapper.Factory,
PythonSetup,
PythonNativeCode.scoped(cls),
PythonSetup.scoped(cls),
)

@memoized_property
Expand Down
Expand Up @@ -14,8 +14,8 @@ class PythonReplIntegrationTest(PantsRunIntegrationTest):
def test_run_repl(self):
# Run a repl on a library target. Avoid some known-to-choke-on interpreters.
command = ['repl',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--python-setup-interpreter-constraints=CPython>=2.7,<3',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--quiet']
program = 'from interpreter_selection.echo_interpreter_version import say_hello; say_hello()'
pants_run = self.run_pants(command=command, stdin_data=program)
Expand All @@ -26,8 +26,8 @@ def test_run_repl(self):
def test_run_repl_with_2(self):
# Run a Python 2 repl on a Python 2/3 library target.
command = ['repl',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--python-setup-interpreter-constraints=["CPython<3"]',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--quiet']
program = 'from interpreter_selection.echo_interpreter_version import say_hello; say_hello()'
pants_run = self.run_pants(command=command, stdin_data=program)
Expand All @@ -37,8 +37,8 @@ def test_run_repl_with_2(self):
def test_run_repl_with_3(self):
# Run a Python 3 repl on a Python 2/3 library target. Avoid some known-to-choke-on interpreters.
command = ['repl',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--python-setup-interpreter-constraints=["CPython>=3.3"]',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--quiet']
program = 'from interpreter_selection.echo_interpreter_version import say_hello; say_hello()'
pants_run = self.run_pants(command=command, stdin_data=program)
Expand Down

0 comments on commit 87e7d2a

Please sign in to comment.