Skip to content

Instantly share code, notes, and snippets.

@iffy
Created September 23, 2011 16:58
Show Gist options
  • Save iffy/1237869 to your computer and use it in GitHub Desktop.
Save iffy/1237869 to your computer and use it in GitHub Desktop.
minmal doctest example
import doctest
import work
suite = DocTestSuite(work)
# What goes here?
$ python run.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
import unittest
import sys
# this is the code in someone else's package -- I can't change this.
suite = unittest.TestSuite()
module = __import__('work', None, None, [""])
suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(module))
runner = unittest.TextTestRunner()
result = runner.run(suite)
sys.exit(not result.wasSuccessful())
def f():
"""
>>> print 'foo'
bar
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment