T
Thomas Heller
I'm trying to integrate some doctest tests with unittest. The tests
must be exposed as one or more subclasses of unittest.TestCase, so I'm
collecting them with a call to doctest.DocTestSuite(), and then add them
to a TestCase class I have created.
The tests seem to run, but they always seem to succeed - I have no idea
why. Any ideas?
Thomas
---snip---
""""""
def func():
""" """
import doctest, unittest
suite = doctest.DocTestSuite()
class TestCase(unittest.TestCase):
pass
for index, test in enumerate(suite._tests):
setattr(TestCase, "test_%d" % index, test)
if __name__ == "__main__":
if 1:
import unittest
unittest.main()
else:
import doctest
doctest.testmod()
---snip---
must be exposed as one or more subclasses of unittest.TestCase, so I'm
collecting them with a call to doctest.DocTestSuite(), and then add them
to a TestCase class I have created.
The tests seem to run, but they always seem to succeed - I have no idea
why. Any ideas?
Thomas
---snip---
""""""
def func():
""" """
import doctest, unittest
suite = doctest.DocTestSuite()
class TestCase(unittest.TestCase):
pass
for index, test in enumerate(suite._tests):
setattr(TestCase, "test_%d" % index, test)
if __name__ == "__main__":
if 1:
import unittest
unittest.main()
else:
import doctest
doctest.testmod()
---snip---