[TIP] shell-like tests

Chris Wesseling Chris.Wesseling at cwi.nl
Mon Jun 17 07:36:30 PDT 2013


On 2013-06-17T11:12:58+0200, Pierre-Yves David wrote:
> On Mon, Jun 17, 2013 at 06:34:42AM +1000, Martin Pool wrote:
> > I have just extracted the 'shell-like tests' library from bzr's test
> > library.  example:
> > 
> >     def test_echo(self):
> >         run_script(self, """
> >             $ echo hello world
> >             hello world
> >             """)
> > 
> > This library makes it easy to write integration tests for programs with a
> > command-line interface: you just give the command and the expected output.
> > The command can be run as an in-process Python call, to let you precisely
> > control its environment through mocks etc. This style also makes it pretty
> > easy for new contributors to add tests.
> > 
> > https://github.com/sourcefrog/shellliketests
> 
> On similar topic, the Mercurial sell-like tests tools have been extracted as "cram"
> 
>     https://bitheap.org/cram/
> 
> I never tested the bzr one so I have no idea how they compare to each other.

I've been using Ian Bicking's ScriptTest library for that. And this
weekend I learned that it's what the pip project is using too.

It's on pypi.

-- 
Chris Wesseling
Centrum Wiskunde & Informatica (CWI)
https://www.cwi.nl/people/ccw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130617/d801f8d8/attachment.pgp>


More information about the testing-in-python mailing list