Skip to content

Commit d71296f

Browse files
committed
Add mpl-generate-summary INI option
1 parent 562b765 commit d71296f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

docs/configuration.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ Generate test summaries
399399
-----------------------
400400
| **kwarg**: ---
401401
| **CLI**: ``--mpl-generate-summary={html,json,basic-html}``
402-
| **INI**: ---
402+
| **INI**: ``mpl-generate-summary = {html,json,basic-html}``
403403
| Default: ``None``
404404
405405
This option specifies the format of the test summary report to generate, if any.

pytest_mpl/plugin.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,15 @@ def pytest_addoption(parser):
148148
mpl_hash_library_help = "json library of image hashes, relative to location where py.test is run"
149149
group.addoption('--mpl-hash-library', help=mpl_hash_library_help, action='store')
150150
parser.addini("mpl-hash-library", help=mpl_hash_library_help)
151-
group.addoption('--mpl-generate-summary', action='store',
152-
help="Generate a summary report of any failed tests"
153-
", in --mpl-results-path. The type of the report should be "
154-
"specified. Supported types are `html`, `json` and `basic-html`. "
155-
"Multiple types can be specified separated by commas.")
151+
152+
mpl_generate_summary_help = (
153+
"Generate a summary report of any failed tests"
154+
", in --mpl-results-path. The type of the report should be "
155+
"specified. Supported types are `html`, `json` and `basic-html`. "
156+
"Multiple types can be specified separated by commas."
157+
)
158+
group.addoption("--mpl-generate-summary", help=mpl_generate_summary_help, action="store")
159+
parser.addini("mpl-generate-summary", help=mpl_generate_summary_help)
156160

157161
results_path_help = "directory for test results, relative to location where py.test is run"
158162
group.addoption('--mpl-results-path', help=results_path_help, action='store')
@@ -199,7 +203,8 @@ def pytest_configure(config):
199203
results_dir = config.getoption("--mpl-results-path") or config.getini("mpl-results-path")
200204
hash_library = config.getoption("--mpl-hash-library") or config.getini("mpl-hash-library")
201205
_hash_library_from_cli = bool(config.getoption("--mpl-hash-library")) # for backwards compatibility
202-
generate_summary = config.getoption("--mpl-generate-summary")
206+
generate_summary = (config.getoption("--mpl-generate-summary") or
207+
config.getini("mpl-generate-summary"))
203208
results_always = (config.getoption("--mpl-results-always") or
204209
config.getini("mpl-results-always"))
205210
use_full_test_name = (config.getoption("--mpl-use-full-test-name") or

0 commit comments

Comments
 (0)