Commit 51d99b2f authored by Garrett Beaty's avatar Garrett Beaty Committed by LUCI CQ

Fix the use of raw_io output placeholders.

In order to enforce that the test data provided for placeholders is of
the appropriate type (text vs binary), existing mismatches must be
resolved. This will prevent type mismatch issues from occurring when
switching builders to use python3.

Bug: 1273548
Change-Id: I83da25432b67853992d7771aba558fd38520a24e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3300310Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
parent 02f4003f
......@@ -162,7 +162,7 @@ PYTHON_VERSION_COMPATIBILITY: PY2+3
#### **class [GclientApi](/recipes/recipe_modules/gclient/api.py#77)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
&emsp; **@property**<br>&mdash; **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#441)(self):**
&emsp; **@property**<br>&mdash; **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#440)(self):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/gclient/api.py#87)(self, name, cmd, infra_step=True, \*\*kwargs):**
......
......@@ -406,7 +406,6 @@ class GclientApi(recipe_api.RecipeApi):
# gclient recurse prepends a number and a > to each line
# Let's take that out
for line in step_result.stdout.strip().splitlines():
line = line.decode('utf-8')
if 'fatal: bad object' in line:
msg = "Couldn't checkout previous ref: %s" % line
step_result.presentation.logs['DepsDiffException'] = msg
......
......@@ -8,7 +8,7 @@ from recipe_engine import recipe_test_api
class GclientTestApi(recipe_test_api.RecipeTestApi):
def diff_deps_test_data(self, files):
return self.m.raw_io.stream_output(
return self.m.raw_io.stream_output_text(
'\n'.join(['10>%s' % fname for fname in files]))
def output_json(self, projects):
......
......@@ -100,7 +100,7 @@
"Traceback (most recent call last):",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps",
" affected_files = api.gclient.diff_deps(api.path['cache'])",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 413, in diff_deps",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 412, in diff_deps",
" raise self.DepsDiffException(msg)",
"DepsDiffException('Couldn't checkout previous ref: fatal: bad object abcdef1234567890')"
]
......
......@@ -99,7 +99,7 @@
"Traceback (most recent call last):",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps",
" affected_files = api.gclient.diff_deps(api.path['cache'])",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 429, in diff_deps",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 428, in diff_deps",
" raise self.DepsDiffException(msg)",
"DepsDiffException('Unexpected result: autoroll diff found 0 files changed')"
]
......
......@@ -73,7 +73,7 @@ def GenTests(api):
api.properties(diff_deps_files=test_files),
api.override_step_data(
'gclient recursively git diff all DEPS',
api.raw_io.stream_output('fatal: bad object abcdef1234567890'),
api.raw_io.stream_output_text('fatal: bad object abcdef1234567890'),
),
api.expect_exception('DepsDiffException')
)
......
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