Skip to content

Commit

Permalink
Fixes for some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ConorMacBride committed Apr 9, 2023
1 parent 1dce0de commit bc8108b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ File containing baseline hashes
The file containing the baseline hashes that will be compared to the test figures.
Both the kwarg option (``hash_library``) and the CLI option (``--mpl-hash-library``) are relative to the test file.
In this case, the CLI option takes precedence over the kwarg option.
The file must be a JSON file in the same format as one generated by ``--mpl-generate-hash-library``.
If its directory does not exist, it will be created along with any missing parent directories.

Expand Down
9 changes: 9 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,16 @@ Even through the figure has changed, the test will pass, because image compariso
If ``pytest-mpl`` is not installed, the image comparison tests will cause pytest to show a warning, ``PytestReturnNotNoneWarning``.
Installing pytest-mpl will solve this issue.
When ``pytest-mpl`` is installed but not enabled, it will intercept the returned figure and close it without doing any comparison.

Alternatively, the image comparison tests can be deselected by running pytest with ``-m "not mpl_image_compare"``.
Or the following can be included in your test functions to skip if ``pytest-mpl`` is not installed:

.. code-block:: python
@pytest.mark.mpl_image_compare
def test_plot():
pytest.importorskip("pytest_mpl")
...
.. rubric:: Tests can fail when Matplotlib and FreeType versions change

Expand Down

0 comments on commit bc8108b

Please sign in to comment.