lundi 5 octobre 2015

How to get django's unittest TestLoader to find and run my doctests?

In Django, my tests are a set of test_foo.py files inside my_django_app/tests/, which each contain a TestCase subclass, and which django automatically finds and runs.

I have a bunch of utility modules with simple doctests that I would like to be included with my test suite. I tried using doctest.DocTestSuite() to define test suites in my_django_app/tests/test_doctests.py, but django's test runner does not find the new tests in that module.

Is there a way I can create a TestCase class that calls my doctests, or somehow otherwise define a new tests/test_foo.py module that would run these tests?

Aucun commentaire:

Enregistrer un commentaire