diff --git a/launchable/commands/record/tests.py b/launchable/commands/record/tests.py index 8fce46d4c..1c03d3c4f 100644 --- a/launchable/commands/record/tests.py +++ b/launchable/commands/record/tests.py @@ -41,8 +41,14 @@ type=str, metavar='BUILD_NAME' ) +@click.option( + '--debug', + help='print request payload', + default=False, + is_flag=True, +) @click.pass_context -def tests(context, base_path: str, session_id: str, build_name: str): +def tests(context, base_path: str, session_id: str, build_name: str, debug: bool): if session_id and build_name: raise click.UsageError( 'Only one of -build or -session should be specified') @@ -137,14 +143,12 @@ def payload(): yield json.dumps(CaseEvent.from_case_and_suite(self.path_builder, case, suite, p)) yield ']}' - # TODO: this probably should be a flag - if True: - # generator adapter that prints the content - def printer(f): - for d in f: - print(d) - yield d - payload = printer(payload()) + def printer(f): + for d in f: + print(d) + yield d + + payload = printer(payload()) if debug else payload() # str -> bytes then gzip compress payload = (s.encode() for s in payload)