diff --git a/BUILD b/BUILD index 840e6b031c5..db2cdb2de39 100644 --- a/BUILD +++ b/BUILD @@ -32,10 +32,3 @@ files( name = 'pyproject', sources = ['pyproject.toml'], ) - -# NB: This is used for integration tests. This is generated automatically via `./pants` and -# `build-support/bin/bootstrap_pants_pex.sh`. -files( - name = 'pants_pex', - sources = ['pants.pex'], -) diff --git a/pants b/pants index 21baad51d37..79d9b82059c 100755 --- a/pants +++ b/pants @@ -106,27 +106,4 @@ else export PANTS_DEV=1 fi -# Integration tests depend on an up-to-date `pants.pex`. Here, we check if we're running tests -# and ensure the `pants.pex` is generated if so. We do this here, rather than via `pants-plugins`, -# because we want the file to be generated _before_ any tests run, not during that Pants invocation, -# as the dependency is marked via BUILD files so should not be constructed at runtime. -# -# Note that we have no way to distinguish between integration tests vs unit tests here, so we -# unfortunately rebuild the pants.pex for unit tests too. -# -# We do not do this when in CI because CI downloads the PEX from AWS and we never want a worker -# shard to try bootstrapping the PEX itself. -test_goal_used=false -for arg in "$@"; do - if [[ "${arg}" == 'test' || "${arg}" == 'test.*' ]]; then - test_goal_used=true - fi -done - -no_regen_pex="${NO_REGEN_PEX:-${TRAVIS}}" -if [[ "${test_goal_used}" == 'true' && "${no_regen_pex}" != 'true' ]]; then - "$HERE/build-support/bin/bootstrap_pants_pex.sh" - echo -e "Finished bootstrapping pants.pex for integration tests.\n" >&2 -fi - exec_pants_bare "$@" diff --git a/src/python/pants/testutil/BUILD b/src/python/pants/testutil/BUILD index fc8917f1937..7c5e470a666 100644 --- a/src/python/pants/testutil/BUILD +++ b/src/python/pants/testutil/BUILD @@ -25,7 +25,6 @@ python_library( sources = ['pants_run_integration_test.py'], dependencies = [ '//:build_root', - '//:pants_pex', '3rdparty/python:ansicolors', '3rdparty/python:dataclasses', 'src/python/pants/base:build_environment', diff --git a/testprojects/src/python/BUILD b/testprojects/src/python/BUILD index bba5e746847..9ca3b9b89b6 100644 --- a/testprojects/src/python/BUILD +++ b/testprojects/src/python/BUILD @@ -9,7 +9,6 @@ target( ':build_file_imports_module_directory', ':coordinated_runs_directory', ':interpreter_selection_directory', - ':nested_runs_directory', ':no_build_file_directory', ':plugins_directory', ':print_env_directory', @@ -44,11 +43,6 @@ files( sources = ['interpreter_selection/**/*'], ) -files( - name = 'nested_runs_directory', - sources = ['nested_runs/**/*'], -) - files( name = 'no_build_file_directory', sources = ['no_build_file/**/*'], diff --git a/testprojects/src/python/nested_runs/BUILD b/testprojects/src/python/nested_runs/BUILD deleted file mode 100644 index 992dbed9376..00000000000 --- a/testprojects/src/python/nested_runs/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -python_binary( - name="nested_runs", - sources=["run_pants_with_pantsd.py"], - compatibility=['CPython>=3.6'] -) - diff --git a/testprojects/src/python/nested_runs/__init__.py b/testprojects/src/python/nested_runs/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/testprojects/src/python/nested_runs/run_pants_with_pantsd.py b/testprojects/src/python/nested_runs/run_pants_with_pantsd.py deleted file mode 100644 index cc061627bbd..00000000000 --- a/testprojects/src/python/nested_runs/run_pants_with_pantsd.py +++ /dev/null @@ -1,26 +0,0 @@ -import pathlib -import subprocess -import sys - - -def main(): - workdir = sys.argv[1] - config_path = pathlib.Path(workdir) / "pants.toml" - config = [f"--pants-config-files={config_path}"] if config_path.is_file() else [] - - cmd = ( - [ - "./pants.pex", - "--no-pantsrc", - "--print-exception-stacktrace=True", - f"--pants-workdir={workdir}", - ] - + config - + ["goals"] - ) - print(f"Running pants with command {cmd}") - subprocess.run(cmd, check=True) - - -if __name__ == "__main__": - main() diff --git a/tests/python/pants_test/bin/BUILD b/tests/python/pants_test/bin/BUILD index 3bcc6ca4b71..586dc3afe2a 100644 --- a/tests/python/pants_test/bin/BUILD +++ b/tests/python/pants_test/bin/BUILD @@ -10,7 +10,6 @@ python_tests( 'src/python/pants/option', 'src/python/pants/testutil:int-test', 'testprojects:pants_plugins_directory', - 'testprojects/src/python:nested_runs_directory', ], tags = ['integration'], timeout = 120, diff --git a/tests/python/pants_test/bin/test_runner_integration.py b/tests/python/pants_test/bin/test_runner_integration.py index 6aa1012ff46..ae289b73c46 100644 --- a/tests/python/pants_test/bin/test_runner_integration.py +++ b/tests/python/pants_test/bin/test_runner_integration.py @@ -1,7 +1,6 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). -import os from pathlib import Path from pants.base.build_environment import get_buildroot @@ -42,33 +41,3 @@ def test_warning_filter(self): ) self.assert_success(non_warning_run) self.assertNotIn("test warning", non_warning_run.stderr_data) - - def test_parent_build_id_set_only_for_pants_runs_called_by_other_pants_runs(self): - with self.temporary_workdir() as workdir: - command = [ - "run", - "testprojects/src/python/nested_runs", - "--", - workdir, - ] - result = self.run_pants_with_workdir(command, workdir,) - self.assert_success(result) - - run_tracker_dir = os.path.join(workdir, "run-tracker") - self.assertTrue( - os.path.isdir(run_tracker_dir), f"dir path {run_tracker_dir} does not exist!" - ) - run_tracker_sub_dirs = ( - os.path.join(run_tracker_dir, dir_name) - for dir_name in os.listdir(run_tracker_dir) - if dir_name != "latest" - ) - for run_tracker_sub_dir in run_tracker_sub_dirs: - info_path = os.path.join(run_tracker_sub_dir, "info") - assert os.path.isfile(info_path) is True - with open(info_path, "r") as info_f: - lines = dict(line.split(": ", 1) for line in info_f.readlines()) - if "goals" in lines["cmd_line"]: - self.assertIn("parent_build_id", lines) - else: - self.assertNotIn("parent_build_id", lines) diff --git a/tests/python/pants_test/pantsd/BUILD b/tests/python/pants_test/pantsd/BUILD index f9e6bf07899..02fd8f1af12 100644 --- a/tests/python/pants_test/pantsd/BUILD +++ b/tests/python/pants_test/pantsd/BUILD @@ -54,7 +54,6 @@ python_tests( 'examples/src/python/example:hello_directory', 'testprojects/src/python:bad_requirements_directory', 'testprojects/src/python:coordinated_runs_directory', - 'testprojects/src/python:nested_runs_directory', 'testprojects/src/python:print_env_directory', ], tags = ['integration'], diff --git a/tests/python/pants_test/pantsd/test_pantsd_integration.py b/tests/python/pants_test/pantsd/test_pantsd_integration.py index aae349f8327..c8b69786424 100644 --- a/tests/python/pants_test/pantsd/test_pantsd_integration.py +++ b/tests/python/pants_test/pantsd/test_pantsd_integration.py @@ -685,22 +685,3 @@ def test_unhandled_exceptions_only_log_exceptions_once(self): "pants.bin.daemon_pants_runner._PantsRunFinishedWithFailureException: Terminated with 1", result.stderr_data, ) - - def test_inner_runs_dont_deadlock(self): - """Create a pantsd run that calls testprojects/src/python/nested_runs with the appropriate - bootstrap options to avoid restarting pantsd. - - Regression test for issue https://github.com/pantsbuild/pants/issues/7881 - When a run under pantsd calls pants with pantsd inside it, the inner run will time out - waiting for the outer run to end. - - NB: testprojects/src/python/nested_runs assumes that the pants.toml file is in ${workdir}/pants.toml - """ - config = {"GLOBAL": {"pantsd_timeout_when_multiple_invocations": 1}} - with self.pantsd_successful_run_context(extra_config=config) as ctx: - result = ctx.runner( - ["run", "testprojects/src/python/nested_runs", "--", ctx.workdir], expected_runs=2 - ) - ctx.checker.assert_started() - self.assert_success(result) - self.assertNotIn("Another pants invocation is running", result.stderr_data)