Skip to content

Commit d833d37

Browse files
author
Steve Martinelli
committed
Add developer documentation
OSC was missing developer docs, these are critically helpful for new developers. Add sections related to running tests (tox, functional and with the debugger), and generating docs locally. implements bp: developer-documentation Change-Id: I428d89c3e5fc335864bc4f7843506043ec332fe5
1 parent 51ae8c7 commit d833d37

2 files changed

Lines changed: 98 additions & 1 deletion

File tree

‎doc/source/developing.rst‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
===============================
2+
Developing with OpenStackClient
3+
===============================
4+
5+
Testing
6+
-------
7+
8+
Using ``tox``
9+
=============
10+
11+
Before running tests, you should have ``tox`` installed and available in your
12+
environment:
13+
14+
.. code-block:: bash
15+
16+
$ pip install tox
17+
18+
To execute the full suite of tests maintained within OpenStackClient, run:
19+
20+
.. code-block:: bash
21+
22+
$ tox
23+
24+
.. NOTE::
25+
26+
The first time you run ``tox``, it will take additional time to build
27+
virtualenvs. You can later use the ``-r`` option with ``tox`` to rebuild
28+
your virtualenv in a similar manner.
29+
30+
To run tests for one or more specific test environments (for example, the most
31+
common configuration of Python 2.7 and PEP-8), list the environments with the
32+
``-e`` option, separated by spaces:
33+
34+
.. code-block:: bash
35+
36+
$ tox -e py27,pep8
37+
38+
See ``tox.ini`` for the full list of available test environments.
39+
40+
Running functional tests
41+
========================
42+
43+
OpenStackClient also maintains a set of functional tests that are optimally
44+
designed to be run against OpenStack's gate. Optionally, a developer may
45+
choose to run these tests against any OpenStack deployment, however depending
46+
on the services available, results will vary.
47+
48+
To run the entire suite of functional tests:
49+
50+
.. code-block:: bash
51+
52+
$ tox -e functional
53+
54+
To run a specific functional test:
55+
56+
.. code-block:: bash
57+
58+
$ tox -e functional -- --regex functional.tests.compute.v2.test_server
59+
60+
Running with PDB
61+
================
62+
63+
Using PDB breakpoints with ``tox`` and ``testr`` normally doesn't work since
64+
the tests fail with a `BdbQuit` exception rather than stopping at the
65+
breakpoint.
66+
67+
To run with PDB breakpoints during testing, use the `debug` ``tox`` environment
68+
rather than ``py27``. Here's an example, passing the name of a test since
69+
you'll normally only want to run the test that hits your breakpoint:
70+
71+
.. code-block:: bash
72+
73+
$ tox -e debug opentackclient.tests.identity.v3.test_group
74+
75+
For reference, the `debug` ``tox`` environment implements the instructions
76+
here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests
77+
78+
79+
Building the Documentation
80+
--------------------------
81+
82+
The documentation is generated with Sphinx using the ``tox`` command. To
83+
create HTML docs, run the following:
84+
85+
.. code-block:: bash
86+
87+
$ tox -e docs
88+
89+
The resultant HTML will be the ``doc/build/html`` directory.

‎doc/source/index.rst‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ OpenStackClient (aka OSC) is a command-line client for OpenStack that
66
brings the command set for Compute, Identity, Image, Object Store and Volume
77
APIs together in a single shell with a uniform command structure.
88

9-
Contents:
9+
User Documentation
10+
------------------
1011

1112
.. toctree::
1213
:maxdepth: 1
@@ -29,6 +30,13 @@ Getting Started
2930
* Read the source `on OpenStack's Git server`_
3031
* Install OpenStackClient from `PyPi`_ or a `tarball`_
3132

33+
Developer Documentation
34+
-----------------------
35+
36+
.. toctree::
37+
:maxdepth: 1
38+
39+
developing
3240

3341
Project Goals
3442
-------------

0 commit comments

Comments
 (0)