From 49580f93e04fe15459b33632ccc31b35425be8e9 Mon Sep 17 00:00:00 2001 From: Conor MacBride Date: Wed, 2 Feb 2022 17:53:59 +0000 Subject: [PATCH] Force results-always when generating HTML --- pytest_mpl/plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytest_mpl/plugin.py b/pytest_mpl/plugin.py index a972d813..6efa6a42 100644 --- a/pytest_mpl/plugin.py +++ b/pytest_mpl/plugin.py @@ -140,7 +140,8 @@ def pytest_addoption(parser): group.addoption('--mpl-results-path', help=results_path_help, action='store') parser.addini('mpl-results-path', help=results_path_help) - results_always_help = "Always generate result images, not just for failed tests." + results_always_help = ("Always generate result images, not just for failed tests. " + "This option is automatically applied when generating a HTML summary.") group.addoption('--mpl-results-always', action='store_true', help=results_always_help) parser.addini('mpl-results-always', help=results_always_help) @@ -271,6 +272,9 @@ def __init__(self, if len(unsupported_formats) > 0: raise ValueError(f"The mpl summary type(s) '{sorted(unsupported_formats)}' " "are not supported.") + # Ignore `results_always` and always save result images for HTML output + if generate_summary & {'html', 'basic-html'}: + results_always = True self.generate_summary = generate_summary self.results_always = results_always