@@ -147,9 +147,10 @@ def pytest_addoption(parser):
147
147
group .addoption ('--mpl-hash-library' ,
148
148
help = "json library of image hashes, relative to "
149
149
"location where py.test is run" , action = 'store' )
150
- group .addoption ('--mpl-generate-summary' , action = 'store_true' ,
151
- help = "Generate a summary HTML report of any failed tests"
152
- ", in --mpl-results-path" )
150
+ group .addoption ('--mpl-generate-summary' , action = 'store' ,
151
+ help = "Generate a summary report of any failed tests"
152
+ ", in --mpl-results-path. The type of the report should be "
153
+ "specified, the only format supported at the moment is `html`." )
153
154
154
155
results_path_help = "directory for test results, relative to location where py.test is run"
155
156
group .addoption ('--mpl-results-path' , help = results_path_help , action = 'store' )
@@ -261,7 +262,7 @@ def __init__(self,
261
262
results_dir = None ,
262
263
hash_library = None ,
263
264
generate_hash_library = None ,
264
- generate_summary = False
265
+ generate_summary = None
265
266
):
266
267
self .config = config
267
268
self .baseline_dir = baseline_dir
@@ -270,7 +271,9 @@ def __init__(self,
270
271
self .results_dir = path_is_not_none (results_dir )
271
272
self .hash_library = path_is_not_none (hash_library )
272
273
self .generate_hash_library = path_is_not_none (generate_hash_library )
273
- self .generate_summary = bool (generate_summary )
274
+ if generate_summary and generate_summary .lower () not in ("html" ,):
275
+ raise ValueError (f"The mpl summary type '{ generate_summary } ' is not supported." )
276
+ self .generate_summary = generate_summary
274
277
275
278
# Generate the containing dir for all test results
276
279
if not self .results_dir :
@@ -611,7 +614,7 @@ def pytest_unconfigure(self, config):
611
614
with open (hash_library_path , "w" ) as fp :
612
615
json .dump (self ._generated_hash_library , fp , indent = 2 )
613
616
614
- if self .generate_summary :
617
+ if self .generate_summary and self . generate_summary . lower () == 'html' :
615
618
# Generate a list of test directories
616
619
dir_list = [p .relative_to (self .results_dir )
617
620
for p in self .results_dir .iterdir () if p .is_dir ()]
0 commit comments