jeudi 8 mars 2018

Set testing options while django doctesting

Following these posts, I have managed to run my doctest within django with:

# myapp/tests.py

import doctest
def load_tests(loader, tests, ignore):
    tests.addTests(doctest.DocTestSuite())
    return tests

Then running:

python manage.py tests


However, since I am used to test my (non-django) scripts with the simple command:

py.test --doctest-modules -x

I am now quite confused about:

  • testing procedure not stopping after first failure (my good'ol -x) (so I get flooded with results and I need to scroll back all the way up to the first problem each time)
  • option # doctest: +ELLIPSIS not being set by default.

How do I set this kind of options from this django load_tests() hook?

Aucun commentaire:

Enregistrer un commentaire