Command Line Usage
$ functest --help
functest test framework.
functest [options] [test1.py] [test2.py] [filter=test]
(help, --help) Print this help menu.
(pdb, --pdb) Stop on failure and enter pdb debugger.
(nowrap, --nowrap) Don't wrap output to print at end of test run for both stdout and stderr.
Allows output from tests as they run.
(stdout, --stdout) Don't wrap stdout.
(stderr, --stderr) Don't wrap stderr.
(bigtb, --bigtb) Only available if pygments is installed.
This prints a much larger traceback, with the preceeding 4 lines of code in each line of the traceback.
(filter=) Only run tests where the name contains this filter.
Running Tests Normally
Running functest inside a directory will collect all the tests in that directory and any sub-directories that are valid python modules and run them.
functest
If you want to run specific test files you can pass them to the command line.
functest test_a.py functest test_a.py test_b.py
Filters
If you want to filter the actual test methods run inside inside a particular test module or set of test modules you can filter the names of the tests methods that actually get run.
functest filter='invalid'
The previous command would still collect all the same test modules to run, but it would then skip any test functions whose name didn't contain 'invalid'.
Debugging
Functest has a variety of debugging features out of the box
output wrapping
By default all regular stdout and stderr from your tests is held until the end of test execution. This way you can put any print statements you'd like for debugging in your tests and when they are running normally that output will be held until the end.
When your tests aren't working you can turn off the output wrapping of either stdout, stderr, or both.
functest --nowrap functest --stdout functest --stderr
pdb
Since your tests use regular old asserts it's very easy for functest to provide instant pdb post mortem debugging at the point of failure. Running functest with the —pdb option will drop you into the pdb post mortem debugger whenever a test fails.
functest --pdb
big traceback
NOTE: This feature requires pygments be installed
Sometimes you would like to see more of your code surrounding the lines of failure in your traceback than just the line that failed. The —bigtb option will show you a traceback containing many of the lines of failure instead of just a few.
functest --bigtb
