[Zope3-dev] Re: doctests in *.txt files
Jim Fulton
jim at zope.com
Mon Mar 29 12:37:44 EST 2004
Mark McEahern wrote:
> Garrett Smith wrote:
>
>> Nevermind...I just found:
>>
>> zope/interfaces/adapter.txt
>>
>> Btw, anyone interested in a powerful idea for software
>> testing/development, take a look at this.
>
>
>
> At PyCON, Jim Fulton mentioned that it would be nice to add to test.py a
> facility for finding/running pure text doctest-based tests.
I don't think I said this. I didn't mean to. I intend to simply
provide a way to explictly name text files containing tests in test
modules.
> Here's a
> simple method for turning a text file into a doctest.DocTestSuite:
>
> def suiteFromText(name):
> basename = os.path.basename(name)
> prefix, ext = os.path.splitext(basename)
> m = new.module(prefix)
> m.__doc__ = file(name).read()
> m.__file__ = name
> return doctest.DocTestSuite(m)
>
> The simplest thing that could possibly work would be to add
> suiteFromText() to test.py as well as an option like --text to find/run
> *.txt in the directories/packages specified by the other options.
>
> Does this smell too hackish?
It smells too implicit.
We intend to add a function to zope.testing.doctestunit, and later
to doctest, to allow a text file to be named from within a package's
tests.py file (or package).
> Jim also mentioned that it would be nice to refactor test.py so that it
> could be generally useful outside of Zope3. I'd like to tackle that if
> no one else is working on it.
OK. Great. Graham Fawcett got a start on that at PyCon, but It turned out
more complicated than I thought due to some issues which Jeremy mentioned.
Graham actually worked on 2 things:
- Changing the argument handling a bit to make running both unit and functional
the default. This required rearranging some other options. He also
provided more long versions of options.
- Providing a separate configuration file to customize the test runner for
different projects.
I'll try to get the first bit of work checked in this week.
See me response to Jeremy.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list