浏览代码

depot_tools: Run some tests on Python 3 on the bots.

Bug: 984182
Change-Id: I0b7f1e3e056548a27a416c9b4078e54c9e5d60d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1769400
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Edward Lemur 6 年之前
父节点
当前提交
a877ee62b1

+ 7 - 6
PRESUBMIT.py

@@ -56,7 +56,7 @@ def DepotToolsPylint(input_api, output_api):
       disabled_warnings=disabled_warnings)
 
 
-def CommonChecks(input_api, output_api, tests_to_black_list):
+def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3):
   results = []
   results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
   results.extend(input_api.canned_checks.CheckOwnersFormat(
@@ -78,7 +78,8 @@ def CommonChecks(input_api, output_api, tests_to_black_list):
       output_api,
       'tests',
       whitelist=tests_to_white_list,
-      blacklist=tests_to_black_list))
+      blacklist=tests_to_black_list,
+      run_on_python3=run_on_python3))
 
   # Validate CIPD manifests.
   root = input_api.os_path.normpath(
@@ -120,15 +121,15 @@ def CheckChangeOnUpload(input_api, output_api):
       r'^checkout_test\.py$',
       r'^cipd_bootstrap_test\.py$',
       r'^gclient_smoketest\.py$',
-      r'^scm_unittest\.py$',
-      r'^subprocess2_test\.py$',
   ]
-  return CommonChecks(input_api, output_api, tests_to_black_list)
+  # TODO(ehmaldonado): Run Python 3 tests on upload once Python 3 is
+  # bootstrapped on Linux and Mac.
+  return CommonChecks(input_api, output_api, tests_to_black_list, False)
 
 
 def CheckChangeOnCommit(input_api, output_api):
   output = []
-  output.extend(CommonChecks(input_api, output_api, []))
+  output.extend(CommonChecks(input_api, output_api, [], True))
   output.extend(input_api.canned_checks.CheckDoNotSubmit(
       input_api,
       output_api))

+ 1 - 1
gclient_utils.py

@@ -916,7 +916,7 @@ class ExecutionQueue(object):
     running = self.running
     self.running = []
     for t in running:
-      if t.isAlive():
+      if t.is_alive():
         self.running.append(t)
       else:
         t.join()

+ 1 - 1
testing_support/subprocess2_test_script.py

@@ -48,7 +48,7 @@ do('A')
 do('BB')
 do('CCC')
 if options.read:
-  assert options.return_value is 0
+  assert options.return_value == 0
   try:
     while sys.stdin.read(1):
       options.return_value += 1

+ 1 - 1
tests/gclient_eval_unittest.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright 2017 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.

+ 1 - 1
tests/gclient_scm_test.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.

+ 3 - 3
tests/gclient_test.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
@@ -565,8 +565,8 @@ class GclientTest(trial_dir.TestCase):
     obj = gclient.GClient.LoadCurrentConfig(options)
     obj.RunOnDeps('None', [])
     self.assertEqual(['unix'], sorted(obj.enforced_os))
-    self.assertEqual([('unix', 'baz'), ('unix',)],
-                     [dep.target_os for dep in obj.dependencies])
+    self.assertEqual([('unix',), ('unix', 'baz')],
+                     sorted(dep.target_os for dep in obj.dependencies))
     self.assertEqual([('foo', 'svn://example.com/foo'),
                       ('bar', 'svn://example.com/bar')],
                      self._get_processed())

+ 1 - 1
tests/gclient_utils_test.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # coding=utf-8
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be

+ 1 - 1
tests/metrics_test.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright (c) 2018 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.

+ 1 - 1
tests/scm_unittest.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.

+ 1 - 1
tests/subprocess2_test.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env vpython3
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.