Skip to content

Commit

Permalink
Get rid of the '2' registrations of the new python tasks. (pantsbuild…
Browse files Browse the repository at this point in the history
…#4486)

That is, run2, test2 etc.

We no longer need them, and it's tricky to support them (e.g., they
may be stomping on the regular versions' products in weird ways).

Also removes some integration tests of the old python pipeline that
are now just invoking the new one, redundantly with the new one's
own integration tests.

It's not ideal not to have integration tests on the old code, but
since it's deprecated, and has been around forever, and still has
unittests, it should be OK. It doesn't seem worth futzing around
with config in those tests to make sure they invoke the old tasks.

I suspect that this will fix pantsbuild#4485
  • Loading branch information
benjyw authored Apr 19, 2017
1 parent 0de9ac7 commit e6ea7bb
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 141 deletions.
7 changes: 0 additions & 7 deletions src/python/pants/backend/python/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,3 @@ def register_goals():
task(name='setup-py', action=SetupPy).install()
task(name='py', action=PythonBinaryCreate).install('binary')
task(name='isort', action=IsortPythonTask).install('fmt')

# Integration tests of the new pipeline still use the `*2` aliases.
task(name='py', action=PythonRun).install('run2')
task(name='pytest', action=PytestRun).install('test2')
task(name='py', action=PythonRepl).install('repl2')
task(name='py', action=PythonBinaryCreate).install('binary2')
task(name='setup-py2', action=SetupPy).install()
17 changes: 3 additions & 14 deletions src/python/pants/backend/python_old/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@
unicode_literals, with_statement)

from pants.backend.python.register import build_file_aliases as orig_build_file_aliases
from pants.backend.python.tasks2.gather_sources import GatherSources
from pants.backend.python.tasks2.pytest_run import PytestRun as PytestRun2
from pants.backend.python.tasks2.python_binary_create import \
PythonBinaryCreate as PythonBinaryCreate2
from pants.backend.python.tasks2.python_repl import PythonRepl as PythonRepl2
from pants.backend.python.tasks2.python_run import PythonRun as PythonRun2
from pants.backend.python.tasks2.resolve_requirements import ResolveRequirements
from pants.backend.python.tasks2.select_interpreter import SelectInterpreter
from pants.backend.python.tasks2.setup_py import SetupPy as SetupPy2
from pants.backend.python.tasks.pytest_run import PytestRun
from pants.backend.python.tasks.python_binary_create import PythonBinaryCreate
from pants.backend.python.tasks.python_isort import IsortPythonTask
from pants.backend.python.tasks.python_repl import PythonRepl
from pants.backend.python.tasks.python_run import PythonRun
from pants.backend.python.tasks.setup_py import SetupPy
from pants.backend.python.tasks2.gather_sources import GatherSources
from pants.backend.python.tasks2.resolve_requirements import ResolveRequirements
from pants.backend.python.tasks2.select_interpreter import SelectInterpreter
from pants.base.deprecated import deprecated
from pants.goal.task_registrar import TaskRegistrar as task

Expand All @@ -42,8 +36,3 @@ def register_goals():
task(name='interpreter', action=SelectInterpreter).install('pyprep')
task(name='requirements', action=ResolveRequirements).install('pyprep')
task(name='sources', action=GatherSources).install('pyprep')
task(name='py', action=PythonRun2).install('run2')
task(name='pytest', action=PytestRun2).install('test2')
task(name='py', action=PythonRepl2).install('repl2')
task(name='py', action=PythonBinaryCreate2).install('binary2')
task(name='setup-py2', action=SetupPy2).install()
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
class AntlrPyGenIntegrationTest(PantsRunIntegrationTest):

def test_antlr_py_gen_integration(self):
result = self.run_pants(['run2',
result = self.run_pants(['run',
'testprojects/src/python/antlr:eval-bin',
'--run2-py-args="123 * 321"'])
'--run-py-args="123 * 321"'])
self.assertEqual(0, result.returncode)
self.assertIn('39483', result.stdout_data)

Expand Down
9 changes: 0 additions & 9 deletions tests/python/pants_test/backend/python/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ python_tests(
]
)

python_tests(
name='python_repl_integration',
sources=['test_python_repl_integration.py'],
dependencies=[
'tests/python/pants_test:int-test',
],
tags = {'integration'},
)

python_tests(
name='python_isort_task',
sources=['test_python_isort.py'],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PythonReplIntegrationTest(PantsRunIntegrationTest):

def test_run_repl(self):
# Run a repl on a library target. Avoid some known-to-choke-on interpreters.
command = ['repl2',
command = ['repl',
'testprojects/src/python/interpreter_selection:echo_interpreter_version_lib',
'--python-setup-interpreter-constraints=CPython>=2.6,<3',
'--python-setup-interpreter-constraints=CPython>=3.3',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ def test_run_27_and_then_26(self):
with temporary_dir() as interpreters_cache:
pants_ini_config = {'python-setup': {'interpreter_cache_dir': interpreters_cache}}
pants_run_27 = self.run_pants(
command=['run2', '{}:echo_interpreter_version_2.7'.format(self.testproject)],
command=['run', '{}:echo_interpreter_version_2.7'.format(self.testproject)],
config=pants_ini_config
)
self.assert_success(pants_run_27)
pants_run_26 = self.run_pants(
command=['run2', '{}:echo_interpreter_version_2.6'.format(self.testproject),
command=['run', '{}:echo_interpreter_version_2.6'.format(self.testproject),
'--python-setup-interpreter-constraints=CPython>=2.6,<3',
'--python-setup-interpreter-constraints=CPython>=3.3'],
config=pants_ini_config
)
self.assert_success(pants_run_26)

def test_die(self):
command = ['run2',
command = ['run',
'{}:die'.format(self.testproject),
'--python-setup-interpreter-constraints=CPython>=2.6,<3',
'--python-setup-interpreter-constraints=CPython>=3.3',
Expand All @@ -59,7 +59,7 @@ def _run_echo_version(self, version):
binary_target = '{}:{}'.format(self.testproject, binary_name)
# Build a pex.
# Avoid some known-to-choke-on interpreters.
command = ['run2',
command = ['run',
binary_target,
'--python-setup-interpreter-constraints=CPython>=2.6,<3',
'--python-setup-interpreter-constraints=CPython>=3.3',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_setup_py_with_codegen(self):

sdist_path = 'dist/pantsbuild.pants.distance-thrift-python-0.0.1.tar.gz'

command = ['setup-py2',
command = ['setup-py',
'examples/src/thrift/org/pantsbuild/example/distance:distance-python']
pants_run = self.run_pants(command=command)
self.assert_success(pants_run)
Expand Down
10 changes: 0 additions & 10 deletions tests/python/pants_test/python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ python_tests(
tags = {'integration'},
)

python_tests(
name = 'python_run_integration',
sources = ['test_python_run_integration.py'],
dependencies = [
'src/python/pants/util:contextutil',
'tests/python/pants_test:int-test',
],
tags = {'integration'},
)

python_tests(
name = 'python_binary_integration',
sources = ['test_python_binary_integration.py'],
Expand Down
68 changes: 0 additions & 68 deletions tests/python/pants_test/python/test_python_run_integration.py

This file was deleted.

0 comments on commit e6ea7bb

Please sign in to comment.