-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c39be
commit 74c1eb7
Showing
11 changed files
with
44 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,74 @@ | ||
Launching tests (nose) | ||
====================== | ||
|
||
Tests are launched by `nose <https://nose.readthedocs.org/en/latest/>`_, | ||
Tests are launched by `pytest <https://pytest.readthedocs.org/en/latest/>`_, | ||
and you have to tell it to use the **funq** plugin. | ||
|
||
Manual launching | ||
---------------- | ||
|
||
Basically:: | ||
|
||
nosetests --with-funq | ||
pytest --with-funq | ||
|
||
The command must be started from the folder containing tests files and | ||
the **funq.conf** configuration file. | ||
|
||
.. note:: | ||
|
||
There are many options for nose, and some specifics to the **funq** | ||
plugin. See ``nosetests --help`` for an exhaustive list. | ||
There are many options for pytest, and some specifics to the **funq** | ||
plugin. See ``pytest --help`` for an exhaustive list. | ||
|
||
Example:: | ||
|
||
# launch tests with all stdout/stderr output and stop on the first error | ||
nosetests --with-funq -s -x | ||
pytest --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. | ||
Every pytest option may be specified by default in a file named **setup.cfg**. | ||
You can look at the pytest documentation for more informations. | ||
|
||
Example: | ||
|
||
.. code-block:: ini | ||
[nosetests] | ||
[pytest] | ||
verbosity=2 | ||
with-funq=1 | ||
.. note:: | ||
|
||
This configuration is very useful, and allow to type only **nosetests** | ||
on the command line instead of ``nosetests --with-funq -vv``. I highly | ||
This configuration is very useful, and allow to type only **pytest** | ||
on the command line instead of ``pytest --with-funq -vv``. I highly | ||
recommend this configuration and I will use it in the following | ||
documentation. | ||
|
||
Selecting tests to launch | ||
------------------------- | ||
|
||
It s possible to select tests to launch using nose. | ||
It s possible to select tests to launch using pytest. | ||
|
||
Example:: | ||
|
||
# every tests in a given file | ||
nosetests test_export.py | ||
pytest test_export.py | ||
|
||
# every tests of a given class in a test file | ||
nosetests test_export.py:TestExportElectre | ||
pytest test_export.py:TestExportElectre | ||
|
||
# just one test (one method) | ||
nosetests test_export.py:TestExportElectre.test_export_b6 | ||
pytest test_export.py:TestExportElectre.test_export_b6 | ||
|
||
.. note:: | ||
|
||
See the nose documeation fo more information. | ||
See the pytest 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. | ||
|
||
Going further | ||
------------- | ||
|
||
**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 ! | ||
|
||
.. note:: | ||
|
||
It is also easy to write your own `nose plugins <http://nose.readthedocs.org/en/latest/plugins/writing.html>`_. | ||
It is also easy to write your own `pytest plugins <https://docs.pytest.org/en/latest/how-to/writing_plugins.html#writing-your-own-plugin>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.