[ckan-dev] docstrings in tests

David Read david.read at okfn.org
Fri Jan 20 10:54:39 UTC 2012


When a test fails in Nose then it identifies the test by its docstring
if there is one, rather than the test's module and method name. This
makes it difficult to work out exactly which one failed. So rather
than discourage docstrings in tests (docstrings are generally useful)
, I've added a couple of lines to the Nose plugin to only print
docstrings if you do '--docstring'. Let me know if that doesn't suit
anyone.

e.g. This docstring is nice to read, but it doesn't tell me where the test is:

"FAIL: Test deleted package activity stream."

This is what I've changed the default to display now:

"FAIL: ckan.tests.models.test_activity.TestActivity.test_delete_package"

Dave




More information about the ckan-dev mailing list