[TIP] Building a unittest.TestCase from a doctest
jim at zope.com
Tue Dec 18 05:43:38 PST 2007
On Dec 18, 2007, at 1:39 AM, Titus Brown wrote:
> Hi folks,
> both Noah and I have been trying to figure out how to load a doctest
> into a unittest.TestCase.
> In my situation, I would like to load doctests from
> /over/there/module.py into a file 'test.py' that is loaded with other
> unittest.TestCases, and have the doctest run together with the other
> test cases.
> There's already an API to load doctests into a unittest.TestSuite,
> but I
> don't know how to get nose (for example) to run a test suite as a
> of test casese without using a plugin.
> The kind of code I'm looking for would look like this:
> test_run_doctests = doctest.LoadDoctestsFrom(module)
> where test_run_doctests inherits from a unittest.TestCase.
> Any thoughts?
A module may contain multiple tests. I don't understand why you would
want a single test case? This would be like taking any test suite and
saying you want to treat it as a single test case. I must be
More information about the testing-in-python