Where does the command "ls" in some doctest files come from ?
KLEIN Stéphane
stephane at harobed.org
Mon Sep 8 18:04:29 EDT 2008
Le Mon, 08 Sep 2008 12:51:04 +0000, Steven D'Aprano a écrit :
> On Mon, 08 Sep 2008 12:15:15 +0000, KLEIN Stéphane wrote:
>
>> Hi,
>>
>> for example, in http://svn.zope.org/zc.buildout/trunk/src/zc/buildout/
>> tests.py?rev=89831&view=auto test file, there is this doctests :
>
> [snip]
>
>> >>> ls('develop-eggs')
>
>
>> I wonder where does the "ls('develop-eggs')" command come from ?
>>
>> It is doctest buildin command ?
>
> Easy to find out: import doctest and see for yourself:
>
>>>> import doctest
>>>> doctest.ls
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'ls'
>
> You found the ls() function in a docstring from Zope. The doctest seems
> to be testing ls(). That suggests to me that ls() is defined in Zope,
> not doctest.
Well, ls() is one test utility function defined in zc.buildout.testing
module. This module contain many utility function like mkdir, ls, cat...
> Why do you ask?
I'm curious... I've seen this utility and I would like to know how can I
use it.
Regards,
Stephane
More information about the Python-list
mailing list