Where does the command "ls" in some doctest files come from ?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Sep 8 14:51:04 CEST 2008

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 :


>     >>> 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 

Why do you ask?


More information about the Python-list mailing list