Skip to content

Commit 28aaa92

Browse files
committed
Add standalone test script
Fix minor documentation bugs while documenting the script.
1 parent af378c2 commit 28aaa92

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

Diff for: doc/devel/coding_guide.rst

+23-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Coding guide
55
************
66

77
Committing changes
8-
------------------
8+
==================
99

1010
When committing changes to matplotlib, there are a few things to bear
1111
in mind.
@@ -358,7 +358,6 @@ object::
358358
print 'datafile', datafile
359359

360360

361-
.. _license-discussion:
362361

363362

364363

@@ -376,17 +375,31 @@ please ignore it while we consolidate our testing to these locations.)
376375
Running the tests
377376
-----------------
378377

379-
Running the tests is simple. Make sure you have nose installed and
380-
type from within Python::
378+
Running the tests is simple. Make sure you have nose installed and run
379+
the script :file:`tests.py` in the root directory of the distribution.
380+
The script can take any of the usual `nosetest arguments`_, such as
381+
382+
=================== ===========
383+
``-v`` increase verbosity
384+
``-d`` detailed error messages
385+
``--with-coverage`` enable collecting coverage information
386+
=================== ===========
387+
388+
To run a single test from the command line, you can provide a
389+
dot-separated path to the module followed by the function separated by
390+
a colon, eg. (this is assuming the test is installed)::
391+
392+
python tests.py matplotlib.tests.test_simplification:test_clipping
393+
394+
An alternative implementation that does not look at command line
395+
arguments works from within Python::
381396

382397
import matplotlib
383398
matplotlib.test()
384399

385-
To run a single test from the command line, you can provide
386-
a dot-separated path to the module and function, eg.
387-
(this is assuming the test is installed)::
388400

389-
nosetests matplotlib.tests.test_simplification:test_clipping
401+
.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
402+
390403

391404

392405
Writing a simple test
@@ -482,6 +495,8 @@ Let's say you've added a new module named
482495
the list of default tests, append its name to ``default_test_modules``
483496
in :file:`lib/matplotlib/__init__.py`.
484497

498+
.. _license-discussion:
499+
485500
Licenses
486501
========
487502

Diff for: tests.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
#
3+
# This allows running the matplotlib tests from the command line: e.g.
4+
# python tests.py -v -d
5+
# See http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
6+
# for options.
7+
8+
import nose
9+
from matplotlib.testing.noseclasses import KnownFailure
10+
from matplotlib import default_test_modules
11+
12+
def run():
13+
nose.main(addplugins=[KnownFailure()],
14+
defaultTest=default_test_modules)
15+
16+
if __name__ == '__main__':
17+
run()

0 commit comments

Comments
 (0)