Browse Source

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 <iannucci@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Robert Iannucci 2 years ago
parent
commit
716022354a
2 changed files with 8 additions and 65 deletions
  1. 8 21
      PRESUBMIT.py
  2. 0 44
      tests/git_cl_test.py

+ 8 - 21
PRESUBMIT.py

@@ -109,18 +109,6 @@ def CheckUnitTestsOnCommit(input_api, output_api):
 
 
   input_api.SetTimeout(TEST_TIMEOUT_S)
   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.
   # Run only selected tests on Windows.
   test_to_run_list = [r'.*test\.py$']
   test_to_run_list = [r'.*test\.py$']
   tests_to_skip_list = []
   tests_to_skip_list = []
@@ -135,15 +123,14 @@ def CheckUnitTestsOnCommit(input_api, output_api):
         r'.*recipes_test\.py$',
         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)
   return input_api.RunTests(tests)
 
 

+ 0 - 44
tests/git_cl_test.py

@@ -3706,25 +3706,6 @@ class ChangelistTest(unittest.TestCase):
         '--json_output', '/tmp/fake-temp2',
         '--json_output', '/tmp/fake-temp2',
         '--description_file', '/tmp/fake-temp1',
         '--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(
     gclient_utils.FileWrite.assert_any_call(
         '/tmp/fake-temp1', 'description')
         '/tmp/fake-temp1', 'description')
     metrics.collector.add_repeated('sub_commands', {
     metrics.collector.add_repeated('sub_commands', {
@@ -3896,31 +3877,6 @@ class ChangelistTest(unittest.TestCase):
     cl = git_cl.Changelist()
     cl = git_cl.Changelist()
     cl.RunPostUploadHook(2, 'upstream', 'description', False)
     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([
     subprocess2.Popen.assert_called_with([
         'vpython3',
         'vpython3',
         'PRESUBMIT_SUPPORT',
         'PRESUBMIT_SUPPORT',