<div dir="ltr">Thanks for mentioning those two. On a brief read the differences seem to be:<div><br></div><div>- Cram runs test scripts located in separate files, and can patch them with the differences, which would make it great for testing documentation examples, and maybe a bit harder if you want to run some Python setup or mocking code around the code under test.</div>
<div><br></div><div>- ScriptTest returns the output etc from the command for the test to examine, whereas shelliketests and cram automatically diff it against expected output.</div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">
On 18 June 2013 00:36, Chris Wesseling <span dir="ltr"><<a href="mailto:Chris.Wesseling@cwi.nl" target="_blank">Chris.Wesseling@cwi.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 2013-06-17T11:12:58+0200, Pierre-Yves David wrote:<br>
> On Mon, Jun 17, 2013 at 06:34:42AM +1000, Martin Pool wrote:<br>
> > I have just extracted the 'shell-like tests' library from bzr's test<br>
> > library. example:<br>
> ><br>
> > def test_echo(self):<br>
> > run_script(self, """<br>
> > $ echo hello world<br>
> > hello world<br>
> > """)<br>
> ><br>
> > This library makes it easy to write integration tests for programs with a<br>
> > command-line interface: you just give the command and the expected output.<br>
> > The command can be run as an in-process Python call, to let you precisely<br>
> > control its environment through mocks etc. This style also makes it pretty<br>
> > easy for new contributors to add tests.<br>
> ><br>
> > <a href="https://github.com/sourcefrog/shellliketests" target="_blank">https://github.com/sourcefrog/shellliketests</a><br>
><br>
> On similar topic, the Mercurial sell-like tests tools have been extracted as "cram"<br>
><br>
> <a href="https://bitheap.org/cram/" target="_blank">https://bitheap.org/cram/</a><br>
><br>
> I never tested the bzr one so I have no idea how they compare to each other.<br>
<br>
</div></div>I've been using Ian Bicking's ScriptTest library for that. And this<br>
weekend I learned that it's what the pip project is using too.<br>
<br>
It's on pypi.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Chris Wesseling<br>
Centrum Wiskunde & Informatica (CWI)<br>
<a href="https://www.cwi.nl/people/ccw" target="_blank">https://www.cwi.nl/people/ccw</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Martin<br>
</div>