By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,492 Members | 3,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,492 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
>>mkdir('foo')
write('foo', 'setup.py',
... '''
... from setuptools import setup
... setup(name="foo")
... ''')
>>write('buildout.cfg',
... '''
... [buildout]
... develop = foo
... parts =
... ''')
>>print system(join('bin', 'buildout')+' -vv'), # doctest: +ELLIPSIS
Installing...
Develop: '/sample-buildout/foo'
...
Installed /sample-buildout/foo
...
>>ls('develop-eggs')
- foo.egg-link
- zc.recipe.egg.egg-link
>>print system(join('bin', 'buildout')+' -vvv'), # doctest:
+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

Sep 8 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

Why do you ask?

--
Steven
Sep 8 '08 #2

P: n/a
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

Sep 8 '08 #3

P: n/a
On Mon, 08 Sep 2008 22:04:29 +0000, KLEIN Stéphane wrote:
>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.

Untested:

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


--
Steven
Sep 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.