Merge "Add support to use pdb with tox"
This commit is contained in:
commit
76ff764522
@ -82,6 +82,24 @@ the ``kolla/tests/test_kolla_docker.py``` file:
|
|||||||
|
|
||||||
$ tox -e py27 test_kolla_docker.ModuleArgsTest.test_module_args
|
$ tox -e py27 test_kolla_docker.ModuleArgsTest.test_module_args
|
||||||
|
|
||||||
|
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.TestClass.test_name
|
||||||
|
|
||||||
|
For more information see the `oslotest documentation
|
||||||
|
<http://docs.openstack.org/developer/oslotest/features.html#debugging-with-oslo-debug-helper>`_.
|
||||||
|
|
||||||
|
|
||||||
.. rubric:: Footnotes
|
.. rubric:: Footnotes
|
||||||
|
|
||||||
|
3
tox.ini
3
tox.ini
@ -18,6 +18,9 @@ commands =
|
|||||||
find . -type d -name "__pycache__" -delete
|
find . -type d -name "__pycache__" -delete
|
||||||
python setup.py test --slowest --testr-args='{posargs}'
|
python setup.py test --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:debug]
|
||||||
|
commands = oslo_debug_helper {posargs}
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands =
|
commands =
|
||||||
{toxinidir}/tools/run-bashate.sh
|
{toxinidir}/tools/run-bashate.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user