提交 be076cce 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #353 from ldoktor/json_parsing_bug

plugins.remote: Improve json parsing
......@@ -43,14 +43,15 @@ class RemoteTestRunner(TestRunner):
avocado_cmd = ('cd %s; avocado run --force-job-id %s --json - --archive %s' %
(self.remote_test_dir, self.result.stream.job_unique_id, " ".join(urls)))
result = self.result.remote.run(avocado_cmd, ignore_status=True)
json_output = result.stdout.splitlines()[0]
try:
results = json.loads(json_output)
except Exception, details:
raise ValueError('Error loading JSON '
'(full output below): %s\n"""\n%s\n"""' %
(details, result.stdout))
return results
for json_output in result.stdout.splitlines():
# We expect dictionary:
if json_output.startswith('{') and json_output.endswith('}'):
try:
return json.loads(json_output)
except ValueError:
pass
raise ValueError("Can't parse json out of remote's avocado output:"
"\n%s" % result.stdout)
def run_suite(self, params_list):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册