Permalink
Browse files

Merge pull request #358 from rgommers/howto-generator-tests

DOC: add details on how to use generator tests to documentation.
  • Loading branch information...
2 parents f9c6867 + 23dba57 commit 4a2295d09d76b5e3eeeb62bc6d8f384a81af27d5 @njsmith njsmith committed Jul 15, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 doc/TESTS.rst.txt
View
9 doc/TESTS.rst.txt
@@ -198,6 +198,15 @@ Note that 'check_even' is not itself a test (no 'test' in the name),
but 'test_evens' is a generator that returns a series of tests, using
'check_even', across a range of inputs.
+A problem with generator tests can be that if a test is failing, it's
+hard to see for which parameters. To avoid this problem, ensure that:
+
+ - No computation related to the features tested is done in the
+ ``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.
+
.. warning::
Parametric tests cannot be implemented on classes derived from

0 comments on commit 4a2295d

Please sign in to comment.