Skip to content

Instantly share code, notes, and snippets.

@sprytnyk
Last active December 21, 2019 17:23
Show Gist options
  • Save sprytnyk/81badbc7c893636a11eda47ab76bd895 to your computer and use it in GitHub Desktop.
Save sprytnyk/81badbc7c893636a11eda47ab76bd895 to your computer and use it in GitHub Desktop.
import doctest
import unittest
# Paths to one's Python modules
from app import models, views
def test_doctest_suit():
test_suit = unittest.TestSuite()
test_suit.addTest(doctest.DocTestSuite(models))
test_suit.addTest(doctest.DocTestSuite(views))
# There are 3 different levels of a verbosity parameter:
# 0 (quiet): you just get the total numbers of tests executed and the
# global result
# 1 (default): you get the same plus a dot for every successful test or a
# F for every failure
# 2 (verbose): you get the help string of every test and the result
runner = unittest.TextTestRunner(verbosity=2).run(test_suit)
assert not runner.failures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment