Skip to content

Commit 0d11e7b

Browse files
authored
Merge pull request #181 from astrofrog/default-tolerance-style
Add missing CLI and INI options for a consistent API
2 parents a169531 + a36ac38 commit 0d11e7b

15 files changed

+657
-94
lines changed

Diff for: .readthedocs.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ build:
66
python: "3.11"
77

88
python:
9-
system_packages: false
109
install:
1110
- method: pip
1211
path: .

Diff for: docs/configuration.rst

+17-13
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ Directory containing baseline images
8484
------------------------------------
8585
| **kwarg**: ``baseline_dir=<path>``
8686
| **CLI**: ``--mpl-baseline-path=<path>``
87-
| **INI**: ---
87+
| **INI**: ``mpl-baseline-path``
8888
| Default: ``baseline/`` *(relative to the test file)*
8989
9090
The directory containing the baseline images that will be compared to the test figures.
91-
The kwarg option (``baseline_dir``) is relative to the test file, while the CLI option (``--mpl-baseline-path``) is relative to where pytest was run.
91+
The kwarg option (``baseline_dir``) is relative to the test file, while the CLI option (``--mpl-baseline-path``) and INI option (``mpl-baseline-path``) are relative to where pytest was run.
9292
Absolute paths can also be used.
9393
If the directory does not exist, it will be created along with any missing parent directories.
9494

@@ -160,7 +160,7 @@ If you specify a filename that has an extension other than ``png``, you must als
160160
Whether to include the module name in the filename
161161
--------------------------------------------------
162162
| **kwarg**: ---
163-
| **CLI**: ---
163+
| **CLI**: ``--mpl-use-full-test-name``
164164
| **INI**: ``mpl-use-full-test-name``
165165
| Default: ``False``
166166
@@ -191,15 +191,19 @@ File containing baseline hashes
191191
-------------------------------
192192
| **kwarg**: ``hash_library=<path>``
193193
| **CLI**: ``--mpl-hash-library=<path>``
194-
| **INI**: ---
194+
| **INI**: ``mpl-hash-library = <path>``
195195
| Default: *no hash comparison*
196196
197197
The file containing the baseline hashes that will be compared to the test figures.
198-
Both the kwarg option (``hash_library``) and the CLI option (``--mpl-hash-library``) are relative to the test file.
199-
In this case, the CLI option takes precedence over the kwarg option.
198+
The kwarg option (``hash_library``) is relative to the test file, while the INI option (``mpl-hash-library``) is relative to where pytest was run.
200199
The file must be a JSON file in the same format as one generated by ``--mpl-generate-hash-library``.
201200
If its directory does not exist, it will be created along with any missing parent directories.
202201

202+
.. attention::
203+
204+
For backwards compatibility, the CLI option (``--mpl-hash-library``) is relative to the test file.
205+
Also, the CLI option takes precedence over the kwarg option, but the kwarg option takes precedence over the INI option as usual.
206+
203207
Configuring this option disables baseline image comparison.
204208
If you want to enable both hash and baseline image comparison, which we call :doc:`"hybrid mode" <hybrid_mode>`, you must explicitly set the :ref:`baseline directory configuration option <baseline-dir>`.
205209

@@ -222,8 +226,8 @@ Adjusting these options *may* allow tests to pass across a range of Matplotlib a
222226
RMS tolerance
223227
-------------
224228
| **kwarg**: ``tolerance=<value>``
225-
| **CLI**: ---
226-
| **INI**: ---
229+
| **CLI**: ``--mpl-default-tolerance=<value>``
230+
| **INI**: ``mpl-default-tolerance = <value>``
227231
| Default: ``2``
228232
229233
The maximum RMS difference between the result image and the baseline image before the test fails.
@@ -306,8 +310,8 @@ A dictionary of keyword arguments to pass to :func:`matplotlib.pyplot.savefig`.
306310
Matplotlib style
307311
----------------
308312
| **kwarg**: ``style=<name>``
309-
| **CLI**: ---
310-
| **INI**: ---
313+
| **CLI**: ``--mpl-default-style=<name>``
314+
| **INI**: ``mpl-default-style = <name>``
311315
| Default: ``"classic"``
312316
313317
The Matplotlib style to use when saving the figure.
@@ -336,8 +340,8 @@ See the :func:`matplotlib.style.context` ``style`` documentation for the options
336340
Matplotlib backend
337341
------------------
338342
| **kwarg**: ``backend=<name>``
339-
| **CLI**: ---
340-
| **INI**: ---
343+
| **CLI**: ``--mpl-default-backend=<name>``
344+
| **INI**: ``mpl-default-backend = <name>``
341345
| Default: ``"agg"``
342346
343347
The Matplotlib backend to use when saving the figure.
@@ -395,7 +399,7 @@ Generate test summaries
395399
-----------------------
396400
| **kwarg**: ---
397401
| **CLI**: ``--mpl-generate-summary={html,json,basic-html}``
398-
| **INI**: ---
402+
| **INI**: ``mpl-generate-summary = {html,json,basic-html}``
399403
| Default: ``None``
400404
401405
This option specifies the format of the test summary report to generate, if any.

0 commit comments

Comments
 (0)