Skip to content

Commit 4b8f248

Browse files
committed
DOC: start to sketch documentation
1 parent 94518d2 commit 4b8f248

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

doc/devel/contribute.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ project that leads to a scientific publication, please follow the
303303
Coding guidelines
304304
=================
305305

306+
.. _coding_guidelines-API_changes:
307+
306308
API changes
307309
-----------
308310

doc/devel/testing.rst

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,66 @@ and then use ``rng`` when generating the random numbers.
9696

9797
The seed is John Hunter's birthday.
9898

99-
Writing an image comparison test
100-
--------------------------------
99+
Image Comparison tests
100+
----------------------
101+
102+
As noted in :ref:`coding_guidelines-API_changes` we consider any changes to the
103+
visual output of Matplotlib to be an API change. To ensure that our visual
104+
output is consistent we make heavy use of image comparison tests in the
105+
automated test suites. By default, and with only a few exceptions, the tests
106+
compare the expected and test output with zero tolerance which means the output
107+
of Matplotlib is stable at the pixel level across time, platform, and
108+
architecture.
109+
110+
For Agg, which directly produces raster output, we directly compare the output
111+
with saved png. For vector outputs we use an external tool (inkscape for svg
112+
and ghostscript for eps/pdf) to convert both the baseline and test image to a
113+
raster that we can compare. However, different versions of FreeType slightly
114+
shift the placement and size of the rendered text which in turn causes our
115+
tests to fail. Thus, we have historically run the test suite with a fixed
116+
version of FreeType.
117+
118+
In the past we stored a complete set of the test images, against a specific
119+
version of FreeType, in the main source repository. While highly effective,
120+
this was not a sustainable over the long term as the pinned version of FreeType
121+
will eventually need to be updated. Further, while our wheels are built with
122+
the pinned version of FreeType, most other down-stream packages (such as
123+
conda-forge and the Linux distributions) use what ever their currently
124+
supported Freetype is this many of our users are using a version of FreeType
125+
that we do not test.
126+
127+
We now use a combination of testing for self-consistency with files generated
128+
on a developers computer and sets of canonical baseline images generated with
129+
every release.
130+
131+
132+
Generate local baseline images from upstream branch
133+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134+
135+
136+
Adding a test image
137+
^^^^^^^^^^^^^^^^^^^
138+
139+
140+
Update a test image
141+
^^^^^^^^^^^^^^^^^^^
142+
143+
144+
Build Matplotlib with a specific FreeType
145+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146+
147+
148+
Fetch the baseline images for a Matplotlib Release and FreeType version
149+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150+
151+
152+
Generate the baseline images for a Matplotlib Release and FreeType version
153+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154+
155+
156+
157+
Writing an image comparison test [TODO fix]
158+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101159

102160
Writing an image-based test is only slightly more difficult than a simple
103161
test. The main consideration is that you must specify the "baseline", or
@@ -140,6 +198,7 @@ See the documentation of `~matplotlib.testing.decorators.image_comparison` and
140198
`~matplotlib.testing.decorators.check_figures_equal` for additional information
141199
about their use.
142200

201+
143202
Creating a new module in matplotlib.tests
144203
-----------------------------------------
145204

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy