[prev in list] [next in list] [prev in thread] [next in thread]
List: zope-dev
Subject: Re: [Zope-dev] bug in zope.testing 3.7.1?
From: Marius Gedminas <marius () gedmin ! as>
Date: 2008-12-22 13:27:51
Message-ID: 20081222132751.GE2906 () platonas
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Fri, Dec 19, 2008 at 01:37:52PM -0500, Benji York wrote:
> On Fri, Dec 19, 2008 at 1:03 PM, Chris Withers <chris@simplistix.co.uk> wrote:
> > 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).
To get them to accept paths relative to os.getcwd() (or absolute paths
for that matter), pass module_relative=False to DocFileSuite.
> Also, DocFileSuite can take multiple paths,
(I also always forget that.)
> 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 '..')
glob() will search relative to os.getcwd(), while DocFileSuite will
search relative to os.path.dirname(__file__). The two may be different.
Marius Gedminas
--
http://pov.lt/ -- Zope 3 consulting and development
["signature.asc" (application/pgp-signature)]
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic