Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e1bcf2b

Browse filesBrowse files
committed
Merge pull request #4224 from tacaswell/png_only_tests
DOC : update testing docs
2 parents 2153aca + ac1f051 commit e1bcf2b
Copy full SHA for e1bcf2b

File tree

Expand file treeCollapse file tree

1 file changed

+18
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-12
lines changed

‎doc/devel/testing.rst

Copy file name to clipboardExpand all lines: doc/devel/testing.rst
+18-12Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ it::
110110
from matplotlib.testing.decorators import image_comparison
111111
import matplotlib.pyplot as plt
112112

113-
@image_comparison(baseline_images=['spines_axes_positions'])
113+
@image_comparison(baseline_images=['spines_axes_positions'],
114+
extensions=['png'])
114115
def test_spines_axes_positions():
115116
# SF bug 2852168
116117
fig = plt.figure()
@@ -128,23 +129,28 @@ it::
128129

129130
The first time this test is run, there will be no baseline image to
130131
compare against, so the test will fail. Copy the output images (in
131-
this case `result_images/test_category/spines_axes_positions.*`) to
132+
this case `result_images/test_category/spines_axes_positions.png`) to
132133
the correct subdirectory of `baseline_images` tree in the source
133134
directory (in this case
134-
`lib/matplotlib/tests/baseline_images/test_category`). Note carefully
135-
the `.*` at the end: this will copy only the images we need to include
136-
in the `git` repository. The files ending in `_pdf.png` and
137-
`_svg.png` are converted from the `pdf` and `svg` originals on the fly
138-
and do not need to be in the respository. Put these new files under
139-
source code revision control (with `git add`). When rerunning the
140-
tests, they should now pass.
135+
`lib/matplotlib/tests/baseline_images/test_category`). Put this new
136+
file under source code revision control (with `git add`). When
137+
rerunning the tests, they should now pass.
138+
139+
The :func:`~matplotlib.testing.decorators.image_comparison` decorator
140+
defaults to generating ``png``, ``pdf`` and ``svg`` output, but in
141+
interest of keeping the size of the library from ballooning we should only
142+
include the ``svg`` or ``pdf`` outputs if the test is explicitly exercising
143+
a feature dependent on that backend.
141144

142145
There are two optional keyword arguments to the `image_comparison`
143146
decorator:
144147

145-
- `extensions`: If you only wish to test some of the image formats
146-
(rather than the default `png`, `svg` and `pdf` formats), pass a
147-
list of the extensions to test.
148+
- `extensions`: If you only wish to test additional image formats
149+
(rather than just `png`), pass any additional file types in the
150+
list of the extensions to test. When copying the new
151+
baseline files be sure to only copy the output files, not their
152+
conversions to ``png``. For example only copy the files
153+
ending in ``pdf``, not in ``_pdf.png``.
148154

149155
- `tol`: This is the image matching tolerance, the default `1e-3`.
150156
If some variation is expected in the image between runs, this

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.