File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 45
45
from pytest_mpl .summary .html import generate_summary_basic_html , generate_summary_html
46
46
47
47
DEFAULT_STYLE = "classic"
48
- DEFAULT_TOLERANCE : float = 2
48
+ DEFAULT_TOLERANCE = 2
49
49
DEFAULT_BACKEND = "agg"
50
50
51
51
SUPPORTED_FORMATS = {"html" , "json" , "basic-html" }
@@ -230,7 +230,12 @@ def get_cli_or_ini(name, default=None):
230
230
hash_library = get_cli_or_ini ("mpl-hash-library" )
231
231
_hash_library_from_cli = bool (config .getoption ("--mpl-hash-library" )) # for backwards compatibility
232
232
233
- default_tolerance = float (get_cli_or_ini ("mpl-default-tolerance" , DEFAULT_TOLERANCE ))
233
+ default_tolerance = get_cli_or_ini ("mpl-default-tolerance" , DEFAULT_TOLERANCE )
234
+ if isinstance (default_tolerance , str ):
235
+ if default_tolerance .isdigit (): # prefer int if possible
236
+ default_tolerance = int (default_tolerance )
237
+ else :
238
+ default_tolerance = float (default_tolerance )
234
239
default_style = get_cli_or_ini ("mpl-default-style" , DEFAULT_STYLE )
235
240
default_backend = get_cli_or_ini ("mpl-default-backend" , DEFAULT_BACKEND )
236
241
You can’t perform that action at this time.
0 commit comments