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

  • Thread starter KLEIN Stéphane
  • Start date
K

KLEIN Stéphane

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 :

def develop_verbose():
"""
We should be able to deal with setup scripts that aren't setuptools based.
... '''
... from setuptools import setup
... setup(name="foo")
... ''')
... '''
... [buildout]
... develop = foo
... parts =
... ''')
Installing...
Develop: '/sample-buildout/foo'
...
Installed /sample-buildout/foo
...
- foo.egg-link
- zc.recipe.egg.egg-link
+ELLIPSIS
Installing...
Develop: '/sample-buildout/foo'
in: '/sample-buildout/foo'
... -q develop -mxN -d /sample-buildout/develop-eggs/...


"""

I wonder where does the "ls('develop-eggs')" command come from ?

It is doctest buildin command ? Where can I found some documentation
about that ? I see this page http://docs.python.org/lib/module-
doctest.html and I found nothing about that subject.

Thanks for your help,
Stephane
http://docs.python.org/lib/module-doctest.html
 
S

Steven D'Aprano

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]


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

Why do you ask?
 
S

Steven D'Aprano

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]


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

Why do you ask?
 
K

KLEIN Stéphane

Le Mon, 08 Sep 2008 12:51:04 +0000, Steven D'Aprano a écrit :
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]


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

Steven D'Aprano

Well, ls() is one test utility function defined in zc.buildout.testing
module. This module contain many utility function like mkdir, ls, cat...



I'm curious... I've seen this utility and I would like to know how can I
use it.


Untested:

from zc.buildout.testing import ls
ls("somefile")
 

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top