Reland "Add Python 3 support to GetPythonUnitTests"

This reverts commit c03ebf0e1a.

Reason for revert: the original change was not the cause of the test
failures. The actual cause was crrev.com/c/3683105 which was reverted.

Original change's description:
> Revert "Add Python 3 support to GetPythonUnitTests"
>
> This reverts commit dfc71bbe01.
>
> Reason for revert: Breaks all presubmits that do not have skip_shebang_check=True set.
>
> Original change's description:
> > Add Python 3 support to GetPythonUnitTests
> >
> > GetPythonUnitTests (and by extension RunPythonUnitTests) always ran
> > scripts using Python 2. This change adds a python3=False parameter to
> > GetPythonUnitTests to give the option of switching to Python 3, while
> > leaving the default as Python 2. The child scripts are run under one or
> > the other, based on this parameter.
> >
> > This change is needed in support of crrev.com/c/3679801.
> >
> > Bug: 1313804
> > Change-Id: Ic59287352d4941707adaf7981ed7af4201b7d526
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3680099
> > Reviewed-by: Jesse McKenna <jessemckenna@google.com>
> > Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
>
> Bug: 1313804
> Change-Id: I1bd7096b6cfdfed6205e6dc0b5d4498b5b821b97
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3683378
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Christoffer Jansson <jansson@chromium.org>
> Owners-Override: Ben Pastene <bpastene@chromium.org>
> Reviewed-by: Tomas Gunnarsson <tommi@chromium.org>

Bug: 1313804
Change-Id: I15ed90cc35d88ece71eb681acc0acc06cb5c3bcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3685229
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jesse McKenna <jessemckenna@google.com>
changes/29/3685229/2
Bruce Dawson 3 years ago committed by LUCI CQ
parent 5965d3e6fb
commit f3d894fd52

@ -883,7 +883,7 @@ def GetUnitTestsRecursively(input_api,
skip_shebang_check=skip_shebang_check) skip_shebang_check=skip_shebang_check)
def GetPythonUnitTests(input_api, output_api, unit_tests): def GetPythonUnitTests(input_api, output_api, unit_tests, python3=False):
"""Run the unit tests out of process, capture the output and use the result """Run the unit tests out of process, capture the output and use the result
code to determine success. code to determine success.
@ -922,7 +922,10 @@ def GetPythonUnitTests(input_api, output_api, unit_tests):
backpath.append(env.get('PYTHONPATH')) backpath.append(env.get('PYTHONPATH'))
env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath)) env['PYTHONPATH'] = input_api.os_path.pathsep.join((backpath))
env.pop('VPYTHON_CLEAR_PYTHONPATH', None) env.pop('VPYTHON_CLEAR_PYTHONPATH', None)
cmd = [input_api.python_executable, '-m', '%s' % unit_test] if python3:
cmd = [input_api.python3_executable, '-m', '%s' % unit_test]
else:
cmd = [input_api.python_executable, '-m', '%s' % unit_test]
results.append(input_api.Command( results.append(input_api.Command(
name=unit_test_name, name=unit_test_name,
cmd=cmd, cmd=cmd,

Loading…
Cancel
Save