Skip to content

Commit f7f578c

Browse files
committed
Describe how to test regular installations of Matplotlib
1 parent 1eef019 commit f7f578c

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

INSTALL.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ Although not required, we suggest also installing ``IPython`` for
3838
interactive use. To easily install a complete Scientific Python
3939
stack, see :ref:`install_scipy_dists` below.
4040

41-
Test data
42-
---------
43-
44-
The wheels (:file:`*.whl`) on the `PyPI download page
45-
<https://pypi.org/project/matplotlib/>`_ do not contain test data
46-
or example code.
47-
48-
If you want to try the many demos that come in the Matplotlib source
49-
distribution, download the :file:`*.tar.gz` file and look in the
50-
:file:`examples` subdirectory.
51-
52-
To run the test suite:
53-
54-
* extract the :file:`lib/matplotlib/tests` or :file:`lib/mpl_toolkits/tests`
55-
directories from the source distribution.
56-
* install test dependencies: `pytest <https://pypi.org/project/pytest>`_,
57-
MiKTeX, GhostScript, ffmpeg, avconv, ImageMagick, and `Inkscape
58-
<https://inkscape.org/>`_.
59-
* run ``python -mpytest``.
60-
6141
Third-party distributions of Matplotlib
6242
=======================================
6343

doc/devel/testing.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,50 @@ you may (rarely) need to build very old versions of Matplotlib. The following
225225
constraints need to be taken into account:
226226

227227
- Matplotlib 1.3 (or earlier) requires numpy 1.8 (or earlier).
228+
229+
Testing regular installations of Matplotlib
230+
-------------------------------------------
231+
232+
.. note::
233+
234+
There is usually no need to run the tests on regular installations of
235+
Matplotlib. Official releases are tested before publishing.
236+
237+
While rarely needed, it is possible to run the tests on a regular installation
238+
of matplotlib. To do so you need to set up additional dependencies and the
239+
reference images.
240+
241+
Install additional dependencies
242+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243+
Install the :ref:`additional dependencies for testing <test-dependencies>`.
244+
245+
Obtain the reference images
246+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
247+
Many tests compare the plot result against reference images. The reference
248+
images are not part of the regular packaged versions (wheels or conda
249+
packages). If you want to run tests with reference images, you need to obtain
250+
the reference images matching the version of Matplotlib you want to test.
251+
252+
To do so, either download the matching source distribution
253+
``matplotlib-X.Y.Z.tar.gz`` from `PyPI <https://pypi.org/project/matplotlib/>`_
254+
or alternatively, clone the git repository and ``git checkout vX.Y.Z``. Copy
255+
the folder :file:`lib/matplotlib/tests/baseline_images` to the folder
256+
:file:`matplotlib/tests` of your the matplotlib installation to test.
257+
The correct target folder can be found using::
258+
259+
python -c "import matplotlib.tests; print(matplotlib.tests.__file__.rsplit('/', 1)[0])"
260+
261+
An analogous copying of :file:`lib/mpl_toolkits/tests/baseline_images`
262+
is necessary for testing the :ref:`toolkits`.
263+
264+
Run the tests
265+
^^^^^^^^^^^^^
266+
To run the all the tests on your installed version of Matplotlib::
267+
268+
pytest --pyargs matplotlib.tests
269+
270+
The test discovery scope can be narrowed to single test modules or even single
271+
functions::
272+
273+
pytest --pyargs matplotlib.tests.test_simplification.py::test_clipping
274+

0 commit comments

Comments
 (0)