From 716022354a88f641ab22be1a8e7dc1b77079620e Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Wed, 10 May 2023 23:37:36 +0000 Subject: [PATCH] Stop running presubmit unittests with python2. R=ajp@google.com, aravindvasudev@google.com, bryner Bug: 1441784, 1359438 Change-Id: I8ea7b1aee2df016d15d9bf9d630728b76d1e77cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4521757 Commit-Queue: Robbie Iannucci Auto-Submit: Robbie Iannucci Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic Reviewed-by: Aravind Vasudevan Commit-Queue: Aravind Vasudevan --- PRESUBMIT.py | 29 ++++++++--------------------- tests/git_cl_test.py | 44 -------------------------------------------- 2 files changed, 8 insertions(+), 65 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index bd03f6e7a6..af0d075229 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -109,18 +109,6 @@ def CheckUnitTestsOnCommit(input_api, output_api): input_api.SetTimeout(TEST_TIMEOUT_S) - # We still support python2 presubmit tests, so we need to test them. We don't - # run py3 here as the code below will start those tests - tests = input_api.canned_checks.GetUnitTestsInDirectory( - input_api, - output_api, - 'tests', - files_to_check=[ - r'.*presubmit_unittest\.py$', - ], - run_on_python2=True, - run_on_python3=False) - # Run only selected tests on Windows. test_to_run_list = [r'.*test\.py$'] tests_to_skip_list = [] @@ -135,15 +123,14 @@ def CheckUnitTestsOnCommit(input_api, output_api): r'.*recipes_test\.py$', ]) - tests.extend( - input_api.canned_checks.GetUnitTestsInDirectory( - input_api, - output_api, - 'tests', - files_to_check=test_to_run_list, - files_to_skip=tests_to_skip_list, - run_on_python3=True, - run_on_python2=False)) + tests = input_api.canned_checks.GetUnitTestsInDirectory( + input_api, + output_api, + 'tests', + files_to_check=test_to_run_list, + files_to_skip=tests_to_skip_list, + run_on_python3=True, + run_on_python2=False) return input_api.RunTests(tests) diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 915f75da67..28d3d9d45f 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -3706,25 +3706,6 @@ class ChangelistTest(unittest.TestCase): '--json_output', '/tmp/fake-temp2', '--description_file', '/tmp/fake-temp1', ]) - subprocess2.Popen.assert_any_call([ - 'vpython', 'PRESUBMIT_SUPPORT', - '--root', 'root', - '--upstream', 'upstream', - '--verbose', '--verbose', - '--gerrit_url', 'https://chromium-review.googlesource.com', - '--gerrit_project', 'project', - '--gerrit_branch', 'refs/heads/main', - '--author', 'author', - '--issue', '123456', - '--patchset', '7', - '--commit', - '--may_prompt', - '--parallel', - '--all_files', - '--no_diffs', - '--json_output', '/tmp/fake-temp4', - '--description_file', '/tmp/fake-temp3', - ]) gclient_utils.FileWrite.assert_any_call( '/tmp/fake-temp1', 'description') metrics.collector.add_repeated('sub_commands', { @@ -3896,31 +3877,6 @@ class ChangelistTest(unittest.TestCase): cl = git_cl.Changelist() cl.RunPostUploadHook(2, 'upstream', 'description', False) - subprocess2.Popen.assert_any_call([ - 'vpython', - 'PRESUBMIT_SUPPORT', - '--root', - 'root', - '--upstream', - 'upstream', - '--verbose', - '--verbose', - '--gerrit_url', - 'https://chromium-review.googlesource.com', - '--gerrit_project', - 'project', - '--gerrit_branch', - 'refs/heads/main', - '--author', - 'author', - '--issue', - '123456', - '--patchset', - '7', - '--post_upload', - '--description_file', - '/tmp/fake-temp1', - ]) subprocess2.Popen.assert_called_with([ 'vpython3', 'PRESUBMIT_SUPPORT',