Skip to content

Commit

Permalink
Add standalone test script
Browse files Browse the repository at this point in the history
Fix minor documentation bugs while documenting the script.
  • Loading branch information
jkseppan committed Mar 6, 2011
1 parent af378c2 commit 28aaa92
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
31 changes: 23 additions & 8 deletions doc/devel/coding_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Coding guide
************

Committing changes
------------------
==================

When committing changes to matplotlib, there are a few things to bear
in mind.
Expand Down Expand Up @@ -358,7 +358,6 @@ object::
print 'datafile', datafile


.. _license-discussion:



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

Running the tests is simple. Make sure you have nose installed and
type from within Python::
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.
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
=================== ===========

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

An alternative implementation that does not look at command line
arguments works from within Python::

import matplotlib
matplotlib.test()

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

nosetests matplotlib.tests.test_simplification:test_clipping
.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html



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

.. _license-discussion:

Licenses
========

Expand Down
17 changes: 17 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python
#
# This allows running the matplotlib tests from the command line: e.g.
# python tests.py -v -d
# See http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
# for options.

import nose
from matplotlib.testing.noseclasses import KnownFailure
from matplotlib import default_test_modules

def run():
nose.main(addplugins=[KnownFailure()],
defaultTest=default_test_modules)

if __name__ == '__main__':
run()

0 comments on commit 28aaa92

Please sign in to comment.