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