Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3089)

Unified Diff: build/android/pylib/results/presentation/test_results_presentation.py

Issue 2845973004: Dump empty json to output when no shard json file is given. (Closed)
Patch Set: simplify the writing part Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/results/presentation/test_results_presentation.py
diff --git a/build/android/pylib/results/presentation/test_results_presentation.py b/build/android/pylib/results/presentation/test_results_presentation.py
index d7e2b5a300ae13e292647270d54562990dd91462..ef5ab558b31dd66a1d94b118c4dee0283edfaa6a 100755
--- a/build/android/pylib/results/presentation/test_results_presentation.py
+++ b/build/android/pylib/results/presentation/test_results_presentation.py
@@ -306,6 +306,7 @@ def upload_to_google_bucket(html, test_name, builder_name, build_number,
return '%s/%s/%s' % (server_url, bucket, dest)
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--json-file', help='Path of json file.')
@@ -347,16 +348,22 @@ def main():
if ((args.build_properties is None) ==
(args.build_number is None or args.builder_name is None)):
raise parser.error('Exactly one of build_perperties or '
- '(build_number or builder_names) should be given.')
+ '(build_number or builder_name) should be given.')
if (args.build_number is None) != (args.builder_name is None):
raise parser.error('args.build_number and args.builder_name '
- 'has to be be given together'
- 'or not given at all.')
+ 'has to be be given together'
+ 'or not given at all.')
if (len(args.positional) == 0) == (args.json_file is None):
- raise parser.error('Exactly one of args.positional and '
- 'args.json_file should be given.')
+ if args.json_file:
jbudorick 2017/04/27 18:40:37 Given that you're handling the two cases different
BigBossZhiling 2017/04/27 20:41:49 Done.
+ raise parser.error('Exactly one of args.positional and '
+ 'args.json_file should be given.')
+ else:
+ if args.output_json:
+ with open(args.output_json, 'w') as f:
+ f.write('{}')
jbudorick 2017/04/27 18:40:37 nit: json.dump({}, f) I know the result is the sa
BigBossZhiling 2017/04/27 20:41:49 Done.
+ return
if args.build_properties:
build_properties = json.loads(args.build_properties)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698