Hunittest is a user friendly command line interface for unittest. It is to unittest what htop is to top. Just a nicer command line interface. It does not add or change anything to unittest module API.
- Work with any unittest test suites.
- One line progress status output (inspired by ninja). Thus,
buffering of stdout/stderr is always on (no
-b/--buffer
option like in usual unittest driver). - No mandatory dependencies.
- Fancy color if your terminal support it.
- Convenient shell completion if you install argcomplete.
- Support parallel execution of test.
- Error are printed on the go (no need for
-c/--catch
like in unittest). -f/--failfast
option like in unittest.-q/--quiet
option that truly prints nothing. Only the exit status tells you whether the test suite was successful.-t/--top-level-directory
option just like unittest.- Filter rules system.
- Time individual tests.
- ImportError are properly reported while collecting test spec (i.e. you see the exception raised while importing the module instead of an uninformative exception coming from unittest loading system)
- Coverage support if you install coverage.
- Hunittest write a log of all errors/failures (in
.hunittest/log
) so that you can review them using the pager of your choice. By default, it will always popup the pager if the error log file is not empty. You can control this behavior using the--pager
option. - Support
--pdb
option to start debugging when the first error happens. - Run test whose last status was "error" or "failure" first.
- Highlight parts of the traceback concerning user's modules.
- Report detailed test status delta between two runs. Useful to see how many tests have been fixed/broken by your changes.
- Report modification of working directory during test.
- Support sub-tests.
- Tested with Python 3.4.x
It requires Python 3.4.x+ at the moment. And you can install
argcomplete (using pip3
) if you really want to enjoy it all.
$ git clone https://github.com/nicolasdespres/hunittest.git
$ cd hunittest
$ python3 setup.py develop
To uninstall it, you ca do:
$ python3 setup.py develop --uninstall
However, this won't remove the easy install entry script generated.
To enable shell completion follow instructions in argcomplete documentation.
Here is just what I did for zsh
:
Install argcomplete:
pip3 install argcomplete
Add something like this to my
.zshrc
:# Register python completion if type register-python-argcomplete &> /dev/null then eval "$(register-python-argcomplete 'hunittest')" fi
Re-launch your shell:
exec zsh
Once installed you can use Hunittest either like a regular command or like regular python module.
$ hunittest myproject.test
$ python3 -m hunittest myproject.test
Note that when using the later form, the shell completion won't work but you can specify the specific interpreter you want to use.
- Does not work with nested TestCase.
- If shell-completion does not work whereas you have configured it
well, you probably have a module that cannot be imported. In such
case an error message is issued. Sometimes it will be printed more than once
whereas you just hit TAB once. In all case, to trouble shoot the buggy
modules in such situation do:
hunittest -c myproject.test
to check for any error.
See HACKING for details.
Hunittest is released under the term of the Simplified BSD License. Copyright (c) 2015, Nicolas Desprès All rights reserved.