Launching tests (nose)¶
Tests are launched by nose, and you have to tell it to use the funq plugin.
The command must be started from the folder containing tests files and the funq.conf configuration file.
There are many options for nose, and some specifics to the funq
nosetests --help for an exhaustive list.
# launch tests with all stdout/stderr output and stop on the first error nosetests --with-funq -s -x
Defining default options¶
Every nose option may be specified by default in a file named setup.cfg. You can look at the nose documentation for more informations.
[nosetests] verbosity=2 with-funq=1
This configuration is very useful, and allow to type only nosetests
on the command line instead of
nosetests --with-funq -vv. I highly
recommend this configuration and I will use it in the following
Selecting tests to launch¶
It s possible to select tests to launch using nose.
# every tests in a given file nosetests test_export.py # every tests of a given class in a test file nosetests test_export.py:TestExportElectre # just one test (one method) nosetests test_export.py:TestExportElectre.test_export_b6
See the nose documeation fo more information.
If the verbosity option is equal to 2, the tests execution will show test names with the same format. This means that you can then copy/paste a test name to restart it.
nose got plenty of usefuls plugins !
Some are integrated in nose, others are third-party plugins and need a proper installation.
Som of the interesting nose plugins are listed here:
- xunit: format tests output using xunit
- attributeselector: select tests given their attributes
- collect-only: allow to only list tests without really execute them
See the nose documentation, and google to find others usefuls plugins !
It is also easy to write your own nose plugins.