[Zope-dev] bug in zope.testing 3.7.1?

Benji York benji at zope.com
Fri Dec 19 13:37:52 EST 2008


On Fri, Dec 19, 2008 at 1:03 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> Hi Guys,
>
> Line 396 of doctest.py contains code which is, at best,
> platform-specific (and so a bug) or, more likely, irrelevent.

Line 396 of doctest.py from zope.testing 3.7.1 doesn't include a raise.  I'm
assuming you mean line 401 instead.

> I have the following code that runs the tests in all my package's docs:
>
> def test_suite():
>     suite = unittest.TestSuite()
>     for path in \
>      glob(os.path.join(os.path.dirname(__file__),'..','docs','*.txt')):
>         suite.addTest(
>             DocFileSuite(path, optionflags=REPORT_NDIFF|ELLIPSIS)
>             )
>     return suite

Paths to doctest files are relative to the calling module (by default).

Also, DocFileSuite can take multiple paths, so your function can be
simplified to this:

def test_suite():
    paths = glob(os.path.join('..', 'docs', '*.txt'))
    return DocFileSuite(*paths, optionflags=REPORT_NDIFF|ELLIPSIS)

(You might want to use os.path.pardir instead of '..')
--
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope-Dev mailing list