Skip to content

Commit

Permalink
DOC: add info on docstrings in test functions/methods. Also fix a typo.
Browse files Browse the repository at this point in the history
Reviewed by @charris in combination with PR-358.
  • Loading branch information
rgommers committed Jul 15, 2012
1 parent 4a2295d commit 4d37169
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions doc/TESTS.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ whether a certain assumption is valid. If the assertion fails, the test fails.
Note that the Python builtin ``assert`` should not be used, because it is
stripped during compilation with ``-O``.

Note that ``test_`` functions or methods should not have a docstring, because
that makes it hard to identify the test from the output of running the test
suite with ``verbose=2`` (or similar verbosity setting). Use plain comments
(``#``) if necessary.

Sometimes it is convenient to run ``test_yyy.py`` by itself, so we add

::
Expand Down Expand Up @@ -174,7 +179,7 @@ nose decorators::

@nose.with_setup(setup_func, teardown_func)
def test_with_extras():
"""This test uses the setup/teardown functions."""
# This test uses the setup/teardown functions.
global helpful_variable
print " In test_with_extras"
print " Helpful is %s" % helpful_variable
Expand Down Expand Up @@ -205,7 +210,7 @@ hard to see for which parameters. To avoid this problem, ensure that:
``test_*`` generator function, but delegated to a corresponding
``check_*`` function (can be inside the generator, to share namespace).
- The generators are used *solely* for loops over parameters.
- These parameters are *not* arrays.
- Those parameters are *not* arrays.

.. warning::

Expand Down

0 comments on commit 4d37169

Please sign in to comment.