diff --git a/planemo/galaxy/test/actions.py b/planemo/galaxy/test/actions.py index 2bb7d44bb..3c9f43873 100644 --- a/planemo/galaxy/test/actions.py +++ b/planemo/galaxy/test/actions.py @@ -80,7 +80,7 @@ def handle_reports(ctx, structured_data, kwds): except Exception as e: exceptions.append(e) - for report_type in ["html", "markdown", "text", "xunit", "junit", "allure"]: + for report_type in ["html", "markdown", "markdown_minimal", "text", "xunit", "junit", "allure"]: try: _handle_test_output_file(ctx, report_type, structured_data, kwds) except Exception as e: diff --git a/planemo/options.py b/planemo/options.py index 7ceff7de4..867d637c2 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -1531,6 +1531,13 @@ def test_report_options(): help=("Output test report (Markdown style - for humans & " "computers)"), default=None, ), + planemo_option( + "--test_output_markdown_minimal", + type=click.Path(file_okay=True, resolve_path=True), + use_global_config=True, + help=("Output test report (Minimal markdown style - jost the table)"), + default=None, + ), planemo_option( "--test_output_xunit", type=click.Path(file_okay=True, resolve_path=True), diff --git a/planemo/reports/report_markdown_minimal.tpl b/planemo/reports/report_markdown_minimal.tpl new file mode 100644 index 000000000..6d44fcefd --- /dev/null +++ b/planemo/reports/report_markdown_minimal.tpl @@ -0,0 +1,46 @@ +{% from 'macros.tmpl' import render_invocation_details, render_invocation_messages, render_job_parameters, render_steps %} +{% if title %} +# {{ execution_type }} {{ title }} + +{% endif %} +## {{ execution_type }} Summary +{% set state = namespace(found=false) %} +{% set state.success = raw_data.results.total - raw_data.results.errors - raw_data.results.failures - raw_data.results.skips | default(0) %} +{% set state.error = raw_data.results.errors | default(0) %} +{% set state.failure = raw_data.results.failures | default(0) %} +{% set state.skipped = raw_data.results.skipped | default(0) %} + +{% if raw_data.results.total %} +
+
+
+
+
+
+
+
+{% endif %} + +| {{ execution_type }} State | Count | +| ---------- | ----- | +| Total | {{ raw_data.results.total | default(0) }} | +| Passed | {{ state.success }} | +| Error | {{ state.error }} | +| Failure | {{ state.failure }} | +| Skipped | {{ state.skipped }} | + +{% for status, desc in {'error': 'Errored', 'failure': 'Failed', 'success': 'Passed'}.items() if state[status]%} +{% set expanded = "open" if status in ("error", "failure") else "" %} +
{{ desc }} {{ execution_type }}s +{% for test in raw_data.tests %} +{% if test.data.status == status %} +{% if test.data.status == 'success' %} +* ✅ {{ test.id|replace("#","# ") }} +{% else %} +* ❌ {{ test.id|replace("#","# ") }} +{% endif %} +{% endif %} +{% endfor %} + +
+{% endfor %} diff --git a/tests/test_cmd_test_reports.py b/tests/test_cmd_test_reports.py index f2bdcd987..30c013f1e 100644 --- a/tests/test_cmd_test_reports.py +++ b/tests/test_cmd_test_reports.py @@ -20,3 +20,19 @@ def test_allure(self): assert os.path.exists(results_path) assert os.path.isdir(results_path) assert len(os.listdir(results_path)) + + def test_markdown(self): + with self._isolate() as f: + json_path = os.path.join(TEST_DATA_DIR, "issue381.json") + results_path = os.path.join(f, "markdown_results") + self._check_exit_code(["test_reports", "--test_output_markdown", results_path, json_path], exit_code=0) + assert os.path.exists(results_path) + + # Run minimal version + minimal_results_path = os.path.join(f, "minimal_markdown_results") + self._check_exit_code( + ["test_reports", "--test_output_markdown_minimal", minimal_results_path, json_path], exit_code=0 + ) + assert os.path.exists(minimal_results_path) + # Make sure minimal markdown is compacted + assert os.path.getsize(minimal_results_path) < os.path.getsize(results_path)