Commit e9ea0d5c authored by Gavin Mak's avatar Gavin Mak Committed by LUCI CQ

Fix depot_tools tests when running without py2

Currently, running git cl presubmit fails without python 2 installed.
This CL replaces instances of 'python' in fetch_test.py with the generic
sys.executable and fixes a small error testRebaseUpdate due to an extra
period.

Bug: 1289839
Change-Id: Ib5802545af70fe0886448397fa76058bd2036527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3407864Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Reviewed-by: 's avatarAravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
parent 19c4cef8
......@@ -218,7 +218,7 @@ class TestCheckout(unittest.TestCase):
exit_mock.assert_called_once()
def test_run_return_as_value(self):
cmd = ['python', '-c', 'print("foo")']
cmd = [sys.executable, '-c', 'print("foo")']
response = self.checkout.run(cmd, return_stdout=True)
# we expect no response other than information about command
......@@ -227,7 +227,7 @@ class TestCheckout(unittest.TestCase):
self.assertEqual('foo', response.strip())
def test_run_print_to_stdout(self):
cmd = ['python', '-c', 'print("foo")']
cmd = [sys.executable, '-c', 'print("foo")']
# mocked version of sys.std* is not passed to subprocess, use temp files
with self._temporary_file() as stdout:
......
......@@ -219,7 +219,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase):
self.repo.git('checkout', 'origin/main')
_, err = self.repo.capture_stdio(self.mv.main, ['special_K', 'cool branch'])
self.assertIn('fatal: \'cool branch\' is not a valid branch name.', err)
self.assertIn('fatal: \'cool branch\' is not a valid branch name', err)
self.repo.run(self.mv.main, ['special_K', 'cool_branch'])
branches = self.repo.run(set, self.gc.branches())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment