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

Skip to content

Commit 45bcd44

Browse files
committed
Deprecate matplotlib.test()
This is not a function that can be easily executed by the end user with a standard setup. Testing requires substantial setup such as installing additional dependencies and reference data. A function `matplotlib.test()` gives the false impression that a user can simply call it to verify if Matplotlib is working correctly. Running pytest explicitly has become a de-facto standard and allows users to customize the run by various command line arguments. There is no point in having a second own and more limited entry point to tests.
1 parent 06141da commit 45bcd44

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``matplotlib.test()`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Run tests using ``pytest`` from the commandline instead. See :ref:`testing`
4+
for more details. The variable ``matplotlib.default_test_modules`` is only
5+
used for ``matplotlib.test()`` and is thus deprecated as well.

doc/devel/testing.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ not need to be installed, but Matplotlib should be)::
5757
pytest lib/matplotlib/tests/test_simplification.py::test_clipping
5858

5959

60-
An alternative implementation that does not look at command line arguments
61-
and works from within Python is to run the tests from the Matplotlib library
62-
function :func:`matplotlib.test`::
63-
64-
import matplotlib
65-
matplotlib.test()
66-
67-
6860
.. _command-line parameters: http://doc.pytest.org/en/latest/usage.html
6961

7062

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,7 @@ def _init_tests():
11791179
"" if ft2font.__freetype_build_type__ == 'local' else "not "))
11801180

11811181

1182+
@_api.deprecated("3.5", alternative='pytest')
11821183
def test(verbosity=None, coverage=False, **kwargs):
11831184
"""Run the matplotlib test suite."""
11841185

0 commit comments

Comments
 (0)