Add debug environment to tox

The oslo_debug_helper enables developers to use pdb for debugging the
unittests.

Ref: http://docs.openstack.org/developer/oslotest/features.html

Change-Id: I08d4c0fcb2e8015c02f5e9b9d4e9dff7f58d21ea
This commit is contained in:
Lucas Alvares Gomes 2016-06-03 10:21:33 +01:00
parent 3559f15152
commit 7abfe28618
2 changed files with 23 additions and 0 deletions

View File

@ -116,6 +116,26 @@ To run only the pep8/flake8 syntax and style checks::
tox -epep8
Debugging unit tests
--------------------
In order to break into the debugger from a unit test we need to insert
a breaking point to the code:
.. code-block:: python
import pdb; pdb.set_trace()
Then run ``tox`` with the debug environment as one of the following::
tox -e debug
tox -e debug test_file_name
tox -e debug test_file_name.TestClass
tox -e debug test_file_name.TestClass.test_name
For more information see the `oslotest documentation
<http://docs.openstack.org/developer/oslotest/features.html#debugging-with-oslo-debug-helper>`_.
===============================
Exercising the Services Locally
===============================

View File

@ -58,6 +58,9 @@ envdir = {toxworkdir}/venv
commands =
oslo-config-generator --config-file=tools/config/ironic-config-generator.conf
[testenv:debug]
commands = oslo_debug_helper -t ironic/tests/unit {posargs}
[testenv:docs]
setenv = PYTHONHASHSEED=0
sitepackages = False