doctest-alike for a unix shell?

Discussion in 'Python' started by Paddy, Mar 13, 2006.

  1. Paddy

    Paddy Guest

    Hi,
    Anyone know of something that can turn an interactive bash or tcsh
    session into a test the
    way doctest does?

    - Cheers, Paddy.
    Paddy, Mar 13, 2006
    #1
    1. Advertising

  2. Paddy

    JW Guest

    1. Try os.popen:

    >>> import os
    >>> os.popen('echo Hello World').read()

    'Hello World\n'

    2. Try a test environment built for testing shell commands, such as
    DejaGnu:
    http://www.gnu.org/software/dejagnu/
    JW, Mar 13, 2006
    #2
    1. Advertising

  3. Paddy

    Paddy Guest

    Thanks for the pointer to dejagnu, although it is not what I was after.

    The question came about because I was scripting an interface to an
    electronics design automation tool that comes with a TCL interface.
    I was using a companion perl script called from the TCL to do most of
    the more complex checking (I am still not allowed Python at work, sob).

    I found myself testing the perl script by calling it repeatedly from
    tcsh , with different options and different files and directories
    created in its run directory that I knew it was sensitive to. I
    scrolled back in my xterm window and thought that there before me was
    most of my tests! If only their was doctest for tcsh, I could tell the
    tool what my prompt strings were, cut-n-paste my shell session, and
    Bobs yer uncle!

    I guess doctest-alikes could be created for a lot of shell type
    interfaces with distinct prompts.

    - Paddy.
    Paddy, Mar 14, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    5,695
    Jonathan Bromley
    Feb 18, 2005
  2. Timo Nentwig

    J2ME: MemoryImageSource alike?

    Timo Nentwig, Mar 4, 2005, in forum: Java
    Replies:
    17
    Views:
    1,402
    Darryl Pierce
    Mar 22, 2005
  3. Replies:
    2
    Views:
    418
    Jesper Nordenberg
    Jun 2, 2005
  4. tom_usenet

    static constructor alike?

    tom_usenet, Sep 11, 2003, in forum: C++
    Replies:
    2
    Views:
    385
    Jesper Madsen
    Sep 11, 2003
  5. mathieu
    Replies:
    2
    Views:
    263
    mathieu
    Aug 29, 2007
Loading...

Share This Page