toll — poor man’s integration testing¶
toll = test offline locally lightweight
Run commands on multiple configured packages:
- Commands can be set-up steps or a call to the test runner etc.
- Each command is run on each package.
- It stops if a command exits with a non-zero exit code (aka an error).
By MichaelFrey (talk) - Own work, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=7932305
This package is licensed under the MIT License.
Requirements¶
- The packages have to be checked out beforehand.
- Currently the commands have to be identical across all packages. (The only option is to omit the command on a package when the precondition is not met.)
Usage¶
Config file¶
You need an ini style config file. Its name should be toll.ini. Here are example contents of such a file.:
[packages]
my.package.one
my.package.two
[build]
precondition = test -e bin/buildout
command = bin/buildout -n
[test]
command = bin/py.test
For the complete list of possible configuration options see the section Config file.
Run it¶
By default the command named test
from the config file is run:
$ toll
If you specify multiple commands each one is run on each package before proceeding to the next command:
$ toll build test
For other options see:
$ toll --help
Other topics¶
Config file¶
There can be the following sections in the config file:
[packages]¶
This section contains a list of relative paths of packages. They are used to run commands on them.
Example:
[packages]
../foo.bar
pkgs/baz
[<command-name>]¶
All sections besides [packages]
are treated as commands.
Required parameters¶
command
- command to be run
Optional parameters¶
precondition
- do not run the command if the precondition is not met aka ``the command returns a non-zero exit code.ignore-exit-code
- Ignore the exit code of the command it set to any value. This way the the run of toll does not stop after running the command.
Example¶
This a an example of some commands:
[build]
precondition = test -e bin/buildout
command = bin/buildout -n
[test]
command = bin/py.test
[push]
ignore-exit-code = true
command = hg push
The precondition of [build]
checks whether bin/buildout
exists as the
command would fail if not.
Developing toll¶
Author: | Michael Howitz <icemac@gmx.net> |
---|---|
Documentation: | http://toll.readthedocs.io |
PyPI page: | https://pypi.org/project/toll/ |
Issues: | https://github.com/icemac/toll/issues |
Source code: | https://github.com/icemac/toll |
Change log: | https://raw.githubusercontent.com/icemac/toll/master/CHANGES.rst |
Run the tests¶
Install tox as the test runner and the call it to run the tests:
$ tox
To run the tests of toll using toll itself call:
$ python3.5 bootstrap.py
$ bin/buildout
$ bin/toll
Copyright¶
License¶
Copyright 2016-2018 Michael Howitz
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Change log¶
4.1 (unreleased)¶
- Nothing changed yet.
4.0 (2017-12-26)¶
- Add an
ignore-exit-code
to the configuration of the commands to allow a complete run-through of all packages. - Drop support for Python 3.3.
- Also release as wheel.
3.2 (2017-05-16)¶
- Change license from ZPL to MIT.
- Move canonical repository to https://github.com/icemac/toll.
- Add support for PyPy3.
3.1 (2017-01-07)¶
- Colour the own output of toll.
- Add a line above the output for each package.
3.0 (2017-01-06)¶
Backward incompatible changes¶
Add a preconditions to the commands. If the precondition is not met the command is not executed. This can be used to prevent running a command in a package where it will fail.
This requires a new config file format. (See documentation.)
Other changes¶
- Add support for Python 3.6.
2.1 (2016-12-06)¶
- Add compatibility with setuptools >= 30.0.
2.0 (2016-06-17)¶
- Use a default configuration file named
toll.ini
. This can be overwritten using-c
when calling toll. - Allow to specify multiple command which should be called. (See
--help
.) - Make package compatible with Python 2.7, 3.3, 3.4 and PyPy.
1.0 (2016-02-26)¶
- Initial release.