Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4fd85f1

Browse files
committed
Update pytest documentation based on review.
* Prefer py.test over tests.py* Remove redundant hint* Add link to further pytest documentation
1 parenta4427a1 commit4fd85f1

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

‎INSTALL

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ or example code.
106106
If you want to try the many demos that come in the matplotlib source
107107
distribution, download the :file:`*.tar.gz` file and look in the
108108
:file:`examples` subdirectory.
109-
To run the test suite,copy the :file:`lib\\matplotlib\\tests`and
109+
To run the test suite,extract the :file:`lib\\matplotlib\\tests`or
110110
:file:`lib\\mpl_toolkits\\tests` directories from the source
111-
distribution to :file:`sys.prefix\\Lib\\site-packages\\matplotlib` and
112-
:file:`sys.prefix\\Lib\\site-packages\\mpl_toolkits` respectively, and
113-
install `pytest <https://pypi.python.org/pypi/pytest>`_, `mock
114-
<https://pypi.python.org/pypi/mock>`_, Pillow, MiKTeX, GhostScript,
111+
distribution, and install `pytest <https://pypi.python.org/pypi/pytest>`_,
112+
`mock <https://pypi.python.org/pypi/mock>`_, Pillow, MiKTeX, GhostScript,
115113
ffmpeg, avconv, mencoder, ImageMagick, and `Inkscape
116114
<https://inkscape.org/>`_.
117115

‎doc/devel/testing.rst

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Developer's tips for testing
66

77
Matplotlib has a testing infrastructure based onpytest_, making it easy to
88
write new tests. The tests are in:mod:`matplotlib.tests`, and customizations
9-
to the pytest testing infrastructure are in:mod:`matplotlib.tests.conftest`
10-
and:mod:`matplotlib.testing`. (Thereis other old testing cruft around, please
11-
ignore it while we consolidate ourtesting to these locations.)
9+
to the pytest testing infrastructure are in:mod:`matplotlib.testing`. (There
10+
is other old testing cruft around, please ignore it while we consolidate our
11+
testing to these locations.)
1212

1313
.. _pytest:http://doc.pytest.org/en/latest/
1414
.. _mock:https://docs.python.org/dev/library/unittest.mock.html>
@@ -69,11 +69,11 @@ commands, such as:
6969

7070
======================== ===========
7171
``--pep8`` Perform pep8 checks (requirespytest-pep8_)
72-
``--no-network`` Disable tests that require network access
72+
``-m "notnetwork"`` Disable tests that require network access
7373
======================== ===========
7474

7575
Additional arguments are passed on to pytest. See the pytest documentation for
76-
supported arguments. Some of the more important ones are given here:
76+
`supported arguments`_. Some of the more important ones are given here:
7777

7878
============================= ===========
7979
``--verbose`` Be more verbose
@@ -84,26 +84,26 @@ supported arguments. Some of the more important ones are given here:
8484
``--capture=no`` or ``-s`` Do not capture stdout
8585
============================= ===========
8686

87-
To run a single test from the command line, you can provide adot-separated
88-
path to the module,optionally followed by the function separated by two
89-
colons, e.g., (this is assuming the test is installed)::
87+
To run a single test from the command line, you can provide afile path,
88+
optionally followed by the function separated by two colons, e.g., (tests do
89+
not need to be installed, but Matplotlib should be)::
9090

91-
python tests.pymatplotlib.tests.test_simplification::test_clipping
91+
py.test lib/matplotlib/tests/test_simplification.py::test_clipping
9292

93-
or by passing a file path, optionally followed bythefunction separated by two
94-
colons, e.g., (tests do not need to be installed, but Matplotlib should be)::
93+
or, if tests are installed, a dot-separated path tothemodule, optionally
94+
followed by the function separated by two colons, such as::
9595

96-
python tests.py lib/matplotlib/tests/test_simplification.py::test_clipping
96+
py.test --pyargsmatplotlib.tests.test_simplification::test_clipping
9797

9898
If you want to run the full test suite, but want to save wall time try
9999
running the tests in parallel::
100100

101-
python tests.py --capture=no --verbose -n 5
101+
py.test --verbose -n 5
102102

103103
Depending on your version of Python and pytest-xdist, you may need to set
104104
``PYTHONHASHSEED`` to a fixed value when running in parallel::
105105

106-
PYTHONHASHSEED=0python tests.py --capture=no --verbose -n 5
106+
PYTHONHASHSEED=0py.test --verbose -n 5
107107

108108
An alternative implementation that does not look at command line arguments
109109
and works from within Python is to run the tests from the Matplotlib library
@@ -112,16 +112,10 @@ function :func:`matplotlib.test`::
112112
import matplotlib
113113
matplotlib.test()
114114

115-
..hint::
116-
117-
To run the tests you need to install pytest and mock if using python 2.7::
118-
119-
pip install pytest
120-
pip install mock
121-
122115

123116
.. _pytest-xdist:https://pypi.python.org/pypi/pytest-xdist
124117
.. _pytest-timeout:https://pypi.python.org/pypi/pytest-timeout
118+
.. _supported arguments:http://doc.pytest.org/en/latest/usage.html
125119

126120

127121
Writing a simple test
@@ -143,7 +137,7 @@ begin with ``"test_"`` and then within those files for functions beginning with
143137
Tests that have side effects that need to be cleaned up, such as created
144138
figures using the pyplot interface or modified rc params, will be automatically
145139
reset by the pytest fixture
146-
:func:`~matplotlib.tests.conftest.mpl_test_settings`.
140+
:func:`~matplotlib.testing.conftest.mpl_test_settings`.
147141

148142

149143
Writing an image comparison test

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp