Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4552534

Browse files
authored
Merge pull request #9470 from matplotlib/auto-backport-of-pr-9378
Backport PR #9378 on branch v2.1.0-doc
2 parents 0d021b1 + 02b434e commit 4552534

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

doc/devel/contributing.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ use to organize this information.
4545

4646
Thank you for your help in keeping bug reports complete, targeted and descriptive.
4747

48+
.. _installing_for_devs:
49+
4850
Retrieving and installing the latest version of the code
4951
========================================================
5052

@@ -84,17 +86,28 @@ you can use ``git@`` instead of ``https://``, which works through the ssh proto
8486
and might be easier to use if you are using 2-factor authentication.
8587

8688

87-
To make sure the tests run locally you must build against the correct version
88-
of freetype. To configure the build system to fetch and build it either export
89-
the env ``MPLLOCALFREETYPE`` as::
89+
Building Matplotlib for image comparison tests
90+
----------------------------------------------
9091

91-
export MPLLOCALFREETYPE=1
92+
Matplotlib's test suite makes heavy use of image comparison tests,
93+
meaning the result of a plot is compared against a known good result.
94+
Unfortunately, different versions of FreeType produce differently
95+
formed characters, causing these image comparisons to fail. To make
96+
them reproducible, Matplotlib can be built with a special local copy
97+
of FreeType. This is recommended for all Matplotlib developers.
9298

93-
or copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit it to contain
94-
::
99+
Copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit it to contain::
95100

96101
[test]
97102
local_freetype = True
103+
tests = True
104+
105+
or set the ``MPLLOCALFREETYPE`` environmental variable to any true
106+
value.
107+
108+
109+
Installing Matplotlib in developer mode
110+
---------------------------------------
98111

99112
To install Matplotlib (and compile the c-extensions) run the following
100113
command from the top-level directory ::

doc/devel/testing.rst

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ infrastructure are in :mod:`matplotlib.testing`.
2020
Requirements
2121
------------
2222

23+
Install the latest version of Matplotlib as documented in
24+
:ref:`installing_for_devs` In particular, follow the instructions to use a
25+
local FreeType build
26+
2327
The following software is required to run the tests:
2428

2529
- pytest_, version 3.0.0 or later
@@ -35,26 +39,6 @@ Optionally you can install:
3539
- pytest-xdist_ to run tests in parallel
3640

3741

38-
Building matplotlib for image comparison tests
39-
----------------------------------------------
40-
41-
matplotlib's test suite makes heavy use of image comparison tests,
42-
meaning the result of a plot is compared against a known good result.
43-
Unfortunately, different versions of FreeType produce differently
44-
formed characters, causing these image comparisons to fail. To make
45-
them reproducible, matplotlib can be built with a special local copy
46-
of FreeType. This is recommended for all matplotlib developers.
47-
48-
Add the following content to a ``setup.cfg`` file at the root of the
49-
matplotlib source directory::
50-
51-
[test]
52-
local_freetype = True
53-
tests = True
54-
55-
or by setting the ``MPLLOCALFREETYPE`` environmental variable to any true
56-
value.
57-
5842
Running the tests
5943
-----------------
6044

@@ -164,8 +148,7 @@ Writing an image based test is only slightly more difficult than a
164148
simple test. The main consideration is that you must specify the
165149
"baseline", or expected, images in the
166150
:func:`~matplotlib.testing.decorators.image_comparison` decorator. For
167-
example, this test generates a single image and automatically tests
168-
it::
151+
example, this test generates a single image and automatically tests it::
169152

170153
import numpy as np
171154
import matplotlib
@@ -262,13 +245,13 @@ repository <https://github.com/matplotlib/matplotlib/>`_ -- for
262245
example, see `its Travis page
263246
<https://travis-ci.org/matplotlib/matplotlib>`_.
264247

265-
If you want to enable Travis CI for your personal matplotlib GitHub
248+
If you want to enable Travis CI for your personal Matplotlib GitHub
266249
repo, simply enable the repo to use Travis CI in either the Travis CI
267250
UI or the GitHub UI (Admin | Service Hooks). For details, see `the
268251
Travis CI Getting Started page
269252
<https://docs.travis-ci.com/user/getting-started/>`_. This
270253
generally isn't necessary, since any pull request submitted against
271-
the main matplotlib repository will be tested.
254+
the main Matplotlib repository will be tested.
272255

273256
Once this is configured, you can see the Travis CI results at
274257
https://travis-ci.org/your_GitHub_user_name/matplotlib -- here's `an

setupext.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,10 @@ def do_custom_build(self):
11871187
else:
11881188
break
11891189
else:
1190-
raise IOError("Failed to download freetype")
1190+
raise IOError("Failed to download freetype. "
1191+
"You can download the file by "
1192+
"alternative means and copy it "
1193+
" to '{0}'".format(tarball_path))
11911194
try:
11921195
os.makedirs(tarball_cache_dir)
11931196
except OSError:

0 commit comments

Comments
 (0)