Create documentation for tests
Generate documentation for each test from its docstring. The sphinx-apidoc tool is used to generate the .rst files necessary for the generation of the documentation. When the documentation is being build only functions that start with "test" are passed to the resulting documentation. Change-Id: I1878f67e10df9bb1f8289beda8e59a56b5057fe4
This commit is contained in:
parent
24961f6244
commit
a9055010fc
@ -24,6 +24,7 @@
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# Build the plugin registry
|
||||
def build_plugin_registry(app):
|
||||
@ -31,16 +32,20 @@ def build_plugin_registry(app):
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
subprocess.call(['tools/generate-tempest-plugins-list.sh'], cwd=root_dir)
|
||||
|
||||
def autodoc_skip_member_handler(app, what, name, obj, skip, options):
|
||||
return skip or (what == "class" and not name.startswith("test"))
|
||||
|
||||
def setup(app):
|
||||
app.connect('autodoc-skip-member', autodoc_skip_member_handler)
|
||||
if os.getenv('GENERATE_TEMPEST_PLUGIN_LIST', 'true').lower() == 'true':
|
||||
app.connect('builder-inited', build_plugin_registry)
|
||||
|
||||
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
sys.path.insert(0, os.path.abspath('../../tempest'))
|
||||
sys.path.insert(0, os.path.abspath('../../tempest/api'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
@ -204,3 +209,10 @@ latex_documents = [
|
||||
('index', 'doc-tempest.tex', u'Tempest Testing Project',
|
||||
u'OpenStack Foundation', 'manual'),
|
||||
]
|
||||
|
||||
latex_use_xindy = False
|
||||
|
||||
latex_elements = {
|
||||
'maxlistdepth': 20,
|
||||
'printindex': '\\footnotesize\\raggedright\\printindex'
|
||||
}
|
||||
|
@ -56,6 +56,13 @@ Supported OpenStack Releases and Python Versions
|
||||
|
||||
supported_version
|
||||
|
||||
Description of Tests
|
||||
--------------------
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
tests/modules
|
||||
|
||||
For Contributors
|
||||
================
|
||||
|
||||
|
21
doc/source/tests/modules.rst
Normal file
21
doc/source/tests/modules.rst
Normal file
@ -0,0 +1,21 @@
|
||||
Description of Tests
|
||||
====================
|
||||
|
||||
OpenStack Services Integration Tests
|
||||
------------------------------------
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
scenario/modules
|
||||
|
||||
OpenStack Services API Tests
|
||||
----------------------------
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
compute/modules
|
||||
identity/modules
|
||||
image/modules
|
||||
network/modules
|
||||
object_storage/modules
|
||||
volume/modules
|
@ -62,7 +62,7 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
|
||||
This test performs below operations:
|
||||
1. Create couple floating ips for admin and non-admin users.
|
||||
2. Verify if admin can access all floating ips including other user
|
||||
and non-admin user can only access its own floating ips.
|
||||
and non-admin user can only access its own floating ips.
|
||||
"""
|
||||
# Create floating ip from admin user
|
||||
floating_ip_admin = self.admin_floating_ips_client.create_floatingip(
|
||||
|
@ -124,7 +124,7 @@ def idempotent_id(id):
|
||||
def decorator(f):
|
||||
f = testtools.testcase.attr('id-%s' % id)(f)
|
||||
if f.__doc__:
|
||||
f.__doc__ = 'Test idempotent id: %s\n%s' % (id, f.__doc__)
|
||||
f.__doc__ = 'Test idempotent id: %s\n\n%s' % (id, f.__doc__)
|
||||
else:
|
||||
f.__doc__ = 'Test idempotent id: %s' % id
|
||||
return f
|
||||
|
18
tox.ini
18
tox.ini
@ -282,15 +282,31 @@ deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
sphinx-apidoc -f -o doc/source/tests/compute tempest/api/compute
|
||||
sphinx-apidoc -f -o doc/source/tests/identity tempest/api/identity
|
||||
sphinx-apidoc -f -o doc/source/tests/image tempest/api/image
|
||||
sphinx-apidoc -f -o doc/source/tests/network tempest/api/network
|
||||
sphinx-apidoc -f -o doc/source/tests/object_storage tempest/api/object_storage
|
||||
sphinx-apidoc -f -o doc/source/tests/scenario tempest/scenario
|
||||
sphinx-apidoc -f -o doc/source/tests/volume tempest/api/volume
|
||||
rm -rf doc/build
|
||||
sphinx-build -W -b html doc/source doc/build/html
|
||||
whitelist_externals = rm
|
||||
whitelist_externals =
|
||||
rm
|
||||
|
||||
[testenv:pdf-docs]
|
||||
deps = {[testenv:docs]deps}
|
||||
whitelist_externals =
|
||||
rm
|
||||
make
|
||||
commands =
|
||||
sphinx-apidoc -f -o doc/source/tests/compute tempest/api/compute
|
||||
sphinx-apidoc -f -o doc/source/tests/identity tempest/api/identity
|
||||
sphinx-apidoc -f -o doc/source/tests/image tempest/api/image
|
||||
sphinx-apidoc -f -o doc/source/tests/network tempest/api/network
|
||||
sphinx-apidoc -f -o doc/source/tests/object_storage tempest/api/object_storage
|
||||
sphinx-apidoc -f -o doc/source/tests/scenario tempest/scenario
|
||||
sphinx-apidoc -f -o doc/source/tests/volume tempest/api/volume
|
||||
sphinx-build -W -b latex doc/source doc/build/pdf
|
||||
make -C doc/build/pdf
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user