File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545from pytest_mpl .summary .html import generate_summary_basic_html , generate_summary_html
4646
4747DEFAULT_STYLE = "classic"
48- DEFAULT_TOLERANCE : float = 2
48+ DEFAULT_TOLERANCE = 2
4949DEFAULT_BACKEND = "agg"
5050
5151SUPPORTED_FORMATS = {"html" , "json" , "basic-html" }
@@ -230,7 +230,12 @@ def get_cli_or_ini(name, default=None):
230230 hash_library = get_cli_or_ini ("mpl-hash-library" )
231231 _hash_library_from_cli = bool (config .getoption ("--mpl-hash-library" )) # for backwards compatibility
232232
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 )
234239 default_style = get_cli_or_ini ("mpl-default-style" , DEFAULT_STYLE )
235240 default_backend = get_cli_or_ini ("mpl-default-backend" , DEFAULT_BACKEND )
236241
You can’t perform that action at this time.
0 commit comments