[py3] Run gclient git test with py3

R=gavinmak@google.com

Bug: 1376538
Change-Id: I742bc767cb6d7164921a481658517ae148127d47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4491345
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
changes/45/4491345/3
Josip Sokcevic 2 years ago committed by LUCI CQ
parent 9acd55ea89
commit 0ddbf02283

@ -325,13 +325,13 @@ deps = {
hooks = [ hooks = [
{ {
'pattern': '.', 'pattern': '.',
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/git_hooked1\\', \\'w\\').write(\\'git_hooked1\\')'], 'open(\\'src/git_hooked1\\', \\'w\\').write(\\'git_hooked1\\')'],
}, },
{ {
# Should not be run. # Should not be run.
'pattern': 'nonexistent', 'pattern': 'nonexistent',
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'], 'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'],
}, },
] ]
@ -357,7 +357,7 @@ deps = {
# processed. # processed.
pre_deps_hooks = [ pre_deps_hooks = [
{ {
'action': ['python', '-c', 'action': ['python3', '-c',
'print("pre-deps hook"); open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'], 'print("pre-deps hook"); open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'],
} }
] ]
@ -379,11 +379,11 @@ deps = {
# processed. # processed.
pre_deps_hooks = [ pre_deps_hooks = [
{ {
'action': ['python', '-c', 'action': ['python3', '-c',
'print("pre-deps hook"); open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'], 'print("pre-deps hook"); open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'],
}, },
{ {
'action': ['python', '-c', 'import sys; sys.exit(1)'], 'action': ['python3', '-c', 'import sys; sys.exit(1)'],
} }
] ]
""" % { """ % {
@ -463,13 +463,13 @@ hooks = [
{ {
'pattern': '.', 'pattern': '.',
'condition': 'True', 'condition': 'True',
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/git_hooked1\\', \\'w\\').write(\\'{hook1_contents}\\')'], 'open(\\'src/git_hooked1\\', \\'w\\').write(\\'{hook1_contents}\\')'],
}, },
{ {
# Should not be run. # Should not be run.
'pattern': 'nonexistent', 'pattern': 'nonexistent',
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'], 'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'],
}, },
] ]
@ -477,7 +477,7 @@ hooks_os = {
'mac': [ 'mac': [
{ {
'pattern': '.', 'pattern': '.',
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/git_hooked_mac\\', \\'w\\').write(' 'open(\\'src/git_hooked_mac\\', \\'w\\').write('
'\\'git_hooked_mac\\')'], '\\'git_hooked_mac\\')'],
}, },
@ -503,12 +503,12 @@ vars = {
} }
hooks = [ hooks = [
{ {
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/should_run\\', \\'w\\').write(\\'should_run\\')'], 'open(\\'src/should_run\\', \\'w\\').write(\\'should_run\\')'],
'condition': 'true_var or True', 'condition': 'true_var or True',
}, },
{ {
'action': ['python', '-c', 'action': ['python3', '-c',
'open(\\'src/should_not_run\\', \\'w\\').write(\\'should_not_run\\')'], 'open(\\'src/should_not_run\\', \\'w\\').write(\\'should_not_run\\')'],
'condition': 'false_var', 'condition': 'false_var',
}, },
@ -651,7 +651,7 @@ deps = {
} }
hooks = [{ hooks = [{
# make sure src/repo12 exists and is a CIPD dir. # make sure src/repo12 exists and is a CIPD dir.
'action': ['python', '-c', 'with open("src/repo12/_cipd"): pass'], 'action': ['python3', '-c', 'with open("src/repo12/_cipd"): pass'],
}] }]
""", """,
'origin': 'git/repo_13@3\n' 'origin': 'git/repo_13@3\n'
@ -702,7 +702,7 @@ hooks = [{
hooks = [{ hooks = [{
"name": "absolute_cwd", "name": "absolute_cwd",
"pattern": ".", "pattern": ".",
"action": ["python", "-c", "pass"] "action": ["python3", "-c", "pass"]
}]"""), }]"""),
'origin': 'git/repo_15@2\n' 'origin': 'git/repo_15@2\n'
}) })
@ -713,7 +713,7 @@ hooks = [{
hooks = [{ hooks = [{
"name": "relative_cwd", "name": "relative_cwd",
"pattern": ".", "pattern": ".",
"action": ["python", "relative.py"] "action": ["python3", "relative.py"]
}]"""), }]"""),
'relative.py': 'pass', 'relative.py': 'pass',
'origin': 'git/repo_16@2\n' 'origin': 'git/repo_16@2\n'

@ -427,10 +427,9 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
('running', self.root_dir), # pre-deps hook ('running', self.root_dir), # pre-deps hook
('running', self.root_dir), # pre-deps hook (fails) ('running', self.root_dir), # pre-deps hook (fails)
] ]
vpython = 'vpython.bat' if sys.platform == 'win32' else 'vpython' expected_stderr = ("Error: Command 'python3 -c import sys; "
expected_stderr = ("Error: Command '%s -c import sys; " "sys.exit(1)' returned non-zero exit status 1 in %s\n" %
"sys.exit(1)' returned non-zero exit status 1 in %s\n" (self.root_dir))
% (vpython, self.root_dir))
stdout, stderr, retcode = self.gclient( stdout, stderr, retcode = self.gclient(
['sync', '--deps', 'mac', '--jobs=1', '--revision', ['sync', '--deps', 'mac', '--jobs=1', '--revision',
'src@' + self.githash('repo_5', 3)], error_ok=True) 'src@' + self.githash('repo_5', 3)], error_ok=True)
@ -603,7 +602,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
'hooks = [{', 'hooks = [{',
' "name": "uses_builtin_var",', ' "name": "uses_builtin_var",',
' "pattern": ".",', ' "pattern": ".",',
' "action": ["python", "fake.py",', ' "action": ["python3", "fake.py",',
' "--with-android={checkout_android}"],', ' "--with-android={checkout_android}"],',
'}]', '}]',
])) ]))
@ -629,7 +628,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
'hooks = [{', 'hooks = [{',
' "name": "uses_builtin_var",', ' "name": "uses_builtin_var",',
' "pattern": ".",', ' "pattern": ".",',
' "action": ["python", "fake.py",', ' "action": ["python3", "fake.py",',
' "--with-android={checkout_android}"],', ' "--with-android={checkout_android}"],',
'}]', '}]',
], contents) ], contents)
@ -678,7 +677,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
'hooks = [{', 'hooks = [{',
' "name": "uses_builtin_var",', ' "name": "uses_builtin_var",',
' "pattern": ".",', ' "pattern": ".",',
' "action": ["python", "fake.py",', ' "action": ["python3", "fake.py",',
' "--with-android={checkout_android}"],', ' "--with-android={checkout_android}"],',
'}]', '}]',
])) ]))
@ -803,7 +802,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "condition": \'True\',', ' "condition": \'True\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked1\', \'w\')' ' "open(\'src/git_hooked1\', \'w\')'
'.write(\'git_hooked1\')",', '.write(\'git_hooked1\')",',
@ -815,7 +814,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": "nonexistent",', ' "pattern": "nonexistent",',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked2\', \'w\').write(\'git_hooked2\')",', ' "open(\'src/git_hooked2\', \'w\').write(\'git_hooked2\')",',
' ]', ' ]',
@ -827,7 +826,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "condition": \'checkout_mac\',', ' "condition": \'checkout_mac\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked_mac\', \'w\').write(' ' "open(\'src/git_hooked_mac\', \'w\').write('
'\'git_hooked_mac\')",', '\'git_hooked_mac\')",',
@ -840,7 +839,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": ".",', ' "pattern": ".",',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "pass",', ' "pass",',
' ]', ' ]',
@ -852,7 +851,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": ".",', ' "pattern": ".",',
' "cwd": "src/repo16",', ' "cwd": "src/repo16",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "relative.py",', ' "relative.py",',
' ]', ' ]',
' },', ' },',
@ -1008,7 +1007,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "condition": \'True\',', ' "condition": \'True\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked1\', \'w\')' ' "open(\'src/git_hooked1\', \'w\')'
'.write(\'git_hooked1\')",', '.write(\'git_hooked1\')",',
@ -1020,7 +1019,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": "nonexistent",', ' "pattern": "nonexistent",',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked2\', \'w\').write(\'git_hooked2\')",', ' "open(\'src/git_hooked2\', \'w\').write(\'git_hooked2\')",',
' ]', ' ]',
@ -1032,7 +1031,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "condition": \'checkout_mac\',', ' "condition": \'checkout_mac\',',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "open(\'src/git_hooked_mac\', \'w\').write(' ' "open(\'src/git_hooked_mac\', \'w\').write('
'\'git_hooked_mac\')",', '\'git_hooked_mac\')",',
@ -1045,7 +1044,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": ".",', ' "pattern": ".",',
' "cwd": ".",', ' "cwd": ".",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "-c",', ' "-c",',
' "pass",', ' "pass",',
' ]', ' ]',
@ -1057,7 +1056,7 @@ class GClientSmokeGIT(gclient_smoketest_base.GClientSmokeBase):
' "pattern": ".",', ' "pattern": ".",',
' "cwd": "src/repo16",', ' "cwd": "src/repo16",',
' "action": [', ' "action": [',
' "python",', ' "python3",',
' "relative.py",', ' "relative.py",',
' ]', ' ]',
' },', ' },',

Loading…
Cancel
Save