Search in this blog

Tuesday, December 27, 2016

Run a single python test with tox

This is the hint how to run a single or several specific functional and unit tests in python projects with tox.

Tox environment `functional`:

Run tests by the template of their name:
tox -e functional test_node_list

Run single test specifying full path:
tox -e ironicclient.tests.functional.osc.v1.test_baremetal_node_basic.BaremetalNodeTests.test_list

Run class of tests:
tox -e functional BaremetalNodeTests

Run specific test from class (including those under @ddt):
tox -e functional BaremetalNodeTests.test_delete

Unit tests (py27 for example):

Run several matching tests:
tox -e py27 do_port_show

Run single specific test from specified class:
tox -e py27 PortShellTest.test_do_port_show_invalid_fields

No comments:

Post a Comment