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

Terry Reedy tjreedy at udel.edu
Mon Sep 8 23:02:56 CEST 2008



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

'ls' is the unix abbreviation for the shell command 'list files (in a 
directory)'.  The name is used above for a similar Python function.  It 
presumably was imported somewhere before develop_verbose, or else is 
part of the auto-imported site.py for a development site.




More information about the Python-list mailing list