|
43 | 43 |
|
44 | 44 | import pytest
|
45 | 45 |
|
46 |
| -SUPPORTED_FORMATS = {'html', 'json'} |
| 46 | +from pytest_mpl.summary.html import generate_summary_html |
| 47 | + |
| 48 | +SUPPORTED_FORMATS = {'html', 'json', 'basic-html'} |
47 | 49 |
|
48 | 50 | SHAPE_MISMATCH_ERROR = """Error: Image dimensions did not match.
|
49 | 51 | Expected shape: {expected_shape}
|
@@ -162,7 +164,7 @@ def pytest_addoption(parser):
|
162 | 164 | group.addoption('--mpl-generate-summary', action='store',
|
163 | 165 | help="Generate a summary report of any failed tests"
|
164 | 166 | ", in --mpl-results-path. The type of the report should be "
|
165 |
| - "specified. Supported types are `html` and `json`. " |
| 167 | + "specified. Supported types are `html`, `json` and `basic-html`. " |
166 | 168 | "Multiple types can be specified separated by commas.")
|
167 | 169 |
|
168 | 170 | results_path_help = "directory for test results, relative to location where py.test is run"
|
@@ -732,11 +734,11 @@ def generate_stats(self):
|
732 | 734 | raise ValueError(f"Unknown test status '{test['status']}'.")
|
733 | 735 | self._test_stats = stats
|
734 | 736 |
|
735 |
| - def generate_summary_html(self): |
| 737 | + def generate_summary_basic_html(self): |
736 | 738 | """
|
737 | 739 | Generate a simple HTML table of the failed test results
|
738 | 740 | """
|
739 |
| - html_file = self.results_dir / 'fig_comparison.html' |
| 741 | + html_file = self.results_dir / 'fig_comparison_basic.html' |
740 | 742 | with open(html_file, 'w') as f:
|
741 | 743 |
|
742 | 744 | passed = f"{self._test_stats['passed']} passed"
|
@@ -849,7 +851,10 @@ def pytest_unconfigure(self, config):
|
849 | 851 | summary = self.generate_summary_json()
|
850 | 852 | print(f"A JSON report can be found at: {summary}")
|
851 | 853 | if 'html' in self.generate_summary:
|
852 |
| - summary = self.generate_summary_html() |
| 854 | + summary = generate_summary_html(self._test_results, self.results_dir) |
| 855 | + print(f"A summary of the failed tests can be found at: {summary}") |
| 856 | + if 'basic-html' in self.generate_summary: |
| 857 | + summary = self.generate_summary_basic_html() |
853 | 858 | print(f"A summary of the failed tests can be found at: {summary}")
|
854 | 859 |
|
855 | 860 |
|
|
0 commit comments