Using doctests from within unittests
<p>I typically write both unittests and doctests in my modules. I'd like to automatically run all of my doctests when running the test suite. I think this is possible, but I'm having a hard time with the syntax.</p>

<p>I have the test suite</p>

<pre><code>import unittest
class ts(unittest.TestCase):
    def test_null(self): self.assertTrue(True)
if __name__ == '__main__': unittest.main()
</code></pre>

<p>I'd like to add to this suite all of the doctests in module <code>module1</code>. How can I do this? I've read the <a href="http://docs.python.org/library/doctest.html#unittest-api" rel="nofollow">python docs</a>, but I'm not any closer to success, here. Adding the lines</p>

<pre><code>import doctest
import module1
suite = doctest.DocTestSuite(module1)
</code></pre>

<p>doesn't work. <code>unittest.main()</code> searches through the current file scope and runs every test <strong>case</strong> it finds, right? But DocTestSuite produces a test <strong>suite</strong>. How do I get <code>unittest.main()</code> to run the additional cases in the suite? Or am I just confused and deluded??</p>

<p>Once again, I'd be grateful for any help anyone can offer.</p>
