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:
parent
3559f15152
commit
7abfe28618
@ -116,6 +116,26 @@ To run only the pep8/flake8 syntax and style checks::
|
|||||||
|
|
||||||
tox -epep8
|
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
|
Exercising the Services Locally
|
||||||
===============================
|
===============================
|
||||||
|
3
tox.ini
3
tox.ini
@ -58,6 +58,9 @@ envdir = {toxworkdir}/venv
|
|||||||
commands =
|
commands =
|
||||||
oslo-config-generator --config-file=tools/config/ironic-config-generator.conf
|
oslo-config-generator --config-file=tools/config/ironic-config-generator.conf
|
||||||
|
|
||||||
|
[testenv:debug]
|
||||||
|
commands = oslo_debug_helper -t ironic/tests/unit {posargs}
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
setenv = PYTHONHASHSEED=0
|
setenv = PYTHONHASHSEED=0
|
||||||
sitepackages = False
|
sitepackages = False
|
||||||
|
Loading…
Reference in New Issue
Block a user