[TIP] shell-like tests

Martin Pool mbp at sourcefrog.net
Sun Jun 16 13:34:42 PDT 2013


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

-- 
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130617/d8c4be9f/attachment.htm>


More information about the testing-in-python mailing list