Running the Tests

Ceilometer includes an extensive set of automated unit tests which are run through tox.

  1. Install tox:

    $ sudo pip install tox
    
  2. Run the unit and code-style tests:

    $ cd /opt/stack/ceilometer
    $ tox -e py3,pep8
    

As tox is a wrapper around stestr, it also accepts the same flags as stestr. See the stestr documentation for details about these additional flags.

Use a double hyphen to pass options to stestr. For example, to run only tests under tests/unit/image:

$ tox -e py3 -- image

To debug tests (ie. break into pdb debugger), you can use ‘’debug’’ tox environment. Here’s an example, passing the name of a test since you’ll normally only want to run the test that hits your breakpoint:

$ tox -e debug ceilometer.tests.unit.test_bin

For reference, the debug tox environment implements the instructions here: https://docs.openstack.org/oslotest/latest/user/debugging.html