473,722 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi,

for example, in http://svn.zope.org/zc.buildout/trunk/src/zc/buildout/
tests.py?rev=89 831&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('buildo ut.cfg',
... '''
... [buildout]
... develop = foo
... parts =
... ''')
>>print system(join('bi n', 'buildout')+' -vv'), # doctest: +ELLIPSIS
Installing...
Develop: '/sample-buildout/foo'
...
Installed /sample-buildout/foo
...
>>ls('develop-eggs')
- foo.egg-link
- zc.recipe.egg.e gg-link
>>print system(join('bi n', '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('develo p-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
3 1528
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=89 831&view=auto test file, there is this doctests :
[snip]
>>ls('develop-eggs')
I wonder where does the "ls('develo p-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
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=8 9831&view=auto test file, there is this doctests :

[snip]
> >>ls('develop-eggs')

>I wonder where does the "ls('develo p-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.tes ting
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
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.tes ting
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.tes ting import ls
ls("somefile")


--
Steven
Sep 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2224
by: Xah Lee | last post by:
does anyone know why the folllowing prints to the screen? # python import os os.system(r"ls") Xah xah@xahlee.org ∑ http://xahlee.org/
1
2683
by: kurt.krueckeberg | last post by:
The second line of this script <?php // current directory echo getcwd() . "<br />"; print ( exec("ls *.*") ); ?> should display the names of the four files (it does in an ssh session) which are located in public_html, but instead it displays just one filename, that of this script.
14
2915
by: kpp9c | last post by:
I would like to use the power of Python to build some list structures for me. Namely i have organized a bunch of folders that have soundfiles in them and would like Python to slurp up all the .aif/.aiff (or .wav whatever) files in a given set of directories. My friend hacked up this is perl: $files = `ls /snd/Public/*.aiff`; @snd_filelist = split('\n',$files);
2
6699
by: ramasubramanian.rahul | last post by:
i am trying to implement the unix command ls -l | wc -l in c...( using pipes and excev) its not working.... can anyone help me here ??? thanks in advance rahul #include<stdio.h> 2 #include <fcntl.h> 3 #include <unistd.h>
3
1462
by: perlid | last post by:
Hi, I'm trying to match the characters "-rwx ********". How to match them ? need help.
4
2531
by: jonathan184 | last post by:
Hi I have a perl script, basically what it is suppose to do is check a folder with files. Now the files are checked using a timestamp with the command ls -l so the timestamp in this format is checked. Now what the script does is it checks the time stamp and creates a year folder if it does not exist and then creates a month folder if it does not exist and puts the respective files in the month folders. If the files are created this month then it...
3
34098
by: Ioannis Vranos | last post by:
Is printf("%ls") for printing wchar_t strings defined in C90, or it was added in C95?
0
986
by: Terry Reedy | last post by:
KLEIN Stéphane wrote: '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.
3
2670
by: Philip Semanchuk | last post by:
On Nov 9, 2008, at 7:00 PM, News123 wrote: Look under the heading "Standard Encodings": http://docs.python.org/library/codecs.html Note that both the page you found (which appears to be a copy of the Python documentation) and the reference I provide say, "Neither the list of aliases nor the list of languages is meant to be exhaustive".
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.