From d60dd38b95708ac0c0ce55b8f3e5469df0eb65c9 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 9 Nov 2012 11:35:34 +0100 Subject: [PATCH 1/3] Added utility method to compute tests and tests with coverage in the Makefile --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 8ac97ffe718b..d333f7f88901 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,11 @@ jdh_doc_snapshot: python make.py html latex sf sfpdf; +test: + ${PYTHON} tests.py +test-coverage: + ${PYTHON} tests.py --with-coverage --cover-package=matplotlib + From 4d299590548c1e2c2def4c09f3884400fa315b25 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 9 Nov 2012 13:49:00 +0100 Subject: [PATCH 2/3] Added new makefile command make test and make test-coverage to the documentation --- README.txt | 16 ++++++++++++++ doc/devel/coding_guide.rst | 44 +++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/README.txt b/README.txt index d00538e0e8ad..7efb74a690a6 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,6 @@ +matplotlib +========== + matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python @@ -6,4 +9,17 @@ application servers, and various graphical user interface toolkits. Home page: + +Installation +============= For installation instructions and requirements, see the INSTALL file. + +Testing +======= + +After installation, you can launch the test suite:: + + $ make test + +Consider reading http://matplotlib.org/devel/coding_guide.html#testing for +more information. diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index c49a59c04b6e..a0f7b535cdce 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -367,7 +367,7 @@ customizations to the nose testing infrastructure are in :mod:`matplotlib.testing`. (There is other old testing cruft around, please ignore it while we consolidate our testing to these locations.) -.. _nose: http://somethingaboutorange.com/mrl/projects/nose/ +.. _nose: https://nose.readthedocs.org/en/latest/ Requirements ------------ @@ -384,35 +384,39 @@ The following software is required to run the tests: Running the tests ----------------- -Running the tests is simple. Make sure you have nose installed and run -the script :file:`tests.py` in the root directory of the distribution. +Running the tests is simple. Make sure you have nose installed. There are two +options to run tests in matplotlib: + +- use the makefile, and type ``make test`` or ``make test-coverage`` + +- run the script :file:`tests.py` in the root directory of the distribution. The script can take any of the usual `nosetest arguments`_, such as -=================== =========== -``-v`` increase verbosity -``-d`` detailed error messages -``--with-coverage`` enable collecting coverage information -=================== =========== + =================== =========== + ``-v`` increase verbosity + ``-d`` detailed error messages + ``--with-coverage`` enable collecting coverage information + =================== =========== -To run a single test from the command line, you can provide a -dot-separated path to the module followed by the function separated by -a colon, eg. (this is assuming the test is installed):: + To run a single test from the command line, you can provide a + dot-separated path to the module followed by the function separated by + a colon, eg. (this is assuming the test is installed):: - python tests.py matplotlib.tests.test_simplification:test_clipping + python tests.py matplotlib.tests.test_simplification:test_clipping -An alternative implementation that does not look at command line -arguments works from within Python:: + An alternative implementation that does not look at command line + arguments works from within Python:: - import matplotlib - matplotlib.test() + import matplotlib + matplotlib.test() -.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html + .. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html -Running tests by any means other than `matplotlib.test()` -does not load the nose "knownfailureif" (Known failing tests) plugin, -causing known-failing tests to fail for real. + Running tests by any means other than `matplotlib.test()` + does not load the nose "knownfailureif" (Known failing tests) plugin, + causing known-failing tests to fail for real. Writing a simple test --------------------- From 351308feac1516da281dd5d835c6d87ee18431e3 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Mon, 19 Nov 2012 12:48:30 +0100 Subject: [PATCH 3/3] "python tests.py" should be the documented way to run the tests. --- README.txt | 2 +- doc/devel/coding_guide.rst | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.txt b/README.txt index 7efb74a690a6..90bfeb337abd 100644 --- a/README.txt +++ b/README.txt @@ -19,7 +19,7 @@ Testing After installation, you can launch the test suite:: - $ make test + python tests.py Consider reading http://matplotlib.org/devel/coding_guide.html#testing for more information. diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index a0f7b535cdce..df325a903bcf 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -384,12 +384,9 @@ The following software is required to run the tests: Running the tests ----------------- -Running the tests is simple. Make sure you have nose installed. There are two -options to run tests in matplotlib: +Running the tests is simple. Make sure you have nose installed and run +the script :file:`tests.py` in the root directory of the distribution. -- use the makefile, and type ``make test`` or ``make test-coverage`` - -- run the script :file:`tests.py` in the root directory of the distribution. The script can take any of the usual `nosetest arguments`_, such as =================== ===========