Debian Codegraph @

doc/source/contributor/testing.rst

raw
1 ..
2 Copyright 2012 New Dream Network, LLC (DreamHost)
3
4 Licensed under the Apache License, Version 2.0 (the "License"); you may
5 not use this file except in compliance with the License. You may obtain
6 a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 License for the specific language governing permissions and limitations
14 under the License.
15
16 =================
17 Running the Tests
18 =================
19
20 Ceilometer includes an extensive set of automated unit tests which are
21 run through tox_.
22
23 1. Install ``tox``::
24
25 $ sudo pip install tox
26
27 2. Run the unit and code-style tests::
28
29 $ cd /opt/stack/ceilometer
30 $ tox -e py27,pep8
31
32 As tox is a wrapper around testr, it also accepts the same flags as testr.
33 See the `testr documentation`_ for details about these additional flags.
34
35 .. _testr documentation: https://testrepository.readthedocs.org/en/latest/MANUAL.html
36
37 Use a double hyphen to pass options to testr. For example, to run only tests
38 under tests/unit/image::
39
40 $ tox -e py27 -- image
41
42 To debug tests (ie. break into pdb debugger), you can use ''debug'' tox
43 environment. Here's an example, passing the name of a test since you'll
44 normally only want to run the test that hits your breakpoint::
45
46 $ tox -e debug ceilometer.tests.unit.test_bin
47
48 For reference, the ``debug`` tox environment implements the instructions
49 here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests
50
51 .. _tox: https://tox.readthedocs.io/en/latest/