Optimize unit testing report CLI
This commit is contained in:
@@ -83,12 +83,8 @@ from platformio.test.runners.factory import TestRunnerFactory
|
||||
multiple=True,
|
||||
help="A program argument (multiple are allowed)",
|
||||
)
|
||||
@click.option("--output-format", type=click.Choice(["json", "junit"]))
|
||||
@click.option(
|
||||
"--output-path",
|
||||
default=os.getcwd,
|
||||
type=click.Path(dir_okay=True, resolve_path=True),
|
||||
)
|
||||
@click.option("--output-json", type=click.Path(resolve_path=True))
|
||||
@click.option("--output-junit", type=click.Path(resolve_path=True))
|
||||
@click.option("--verbose", "-v", is_flag=True)
|
||||
@click.pass_context
|
||||
def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
|
||||
@@ -107,8 +103,8 @@ def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-bu
|
||||
monitor_rts,
|
||||
monitor_dtr,
|
||||
program_args,
|
||||
output_format,
|
||||
output_path,
|
||||
output_json,
|
||||
output_junit,
|
||||
verbose,
|
||||
):
|
||||
app.set_session_var("custom_project_conf", project_conf)
|
||||
@@ -181,7 +177,9 @@ def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-bu
|
||||
stdout_report = TestReportFactory.new("stdout", test_result)
|
||||
stdout_report.generate(verbose=verbose)
|
||||
|
||||
if output_format:
|
||||
for output_format, output_path in [("json", output_json), ("junit", output_junit)]:
|
||||
if not output_path:
|
||||
continue
|
||||
custom_report = TestReportFactory.new(output_format, test_result)
|
||||
custom_report.generate(output_path=output_path, verbose=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user