Merge "Convert 'placement_api_docs' into a Sphinx extension"

This commit is contained in:
Zuul 2018-08-01 13:45:35 +00:00 committed by Gerrit Code Review
commit 47ef500f44
4 changed files with 14 additions and 14 deletions

View File

View File

@ -12,7 +12,6 @@
"""Test to see if docs exists for routes and methods in the placement API."""
import os
import sys
from nova.api.openstack.placement import handler
@ -27,11 +26,14 @@ def _header_line(map_entry):
return line
def inspect_doc(doc_files):
def inspect_doc(app):
"""Load up doc_files and see if any routes are missing.
The routes are defined in handler.ROUTE_DECLARATIONS.
"""
doc_files = [os.path.join(app.srcdir, file)
for file in os.listdir(app.srcdir) if file.endswith(".inc")]
routes = []
for route in sorted(handler.ROUTE_DECLARATIONS, key=len):
# Skip over the '' route.
@ -56,16 +58,11 @@ def inspect_doc(doc_files):
missing_lines.append(line)
if missing_lines:
print('Documentation likely missing for the following routes:')
msg = ['Documentation likely missing for the following routes:', '']
for line in missing_lines:
print(line)
return 1
return 0
msg.append(line)
raise ValueError('\n'.join(msg))
if __name__ == '__main__':
path = sys.argv[1]
doc_files = [os.path.join(path, file)
for file in os.listdir(path) if file.endswith(".inc")]
sys.exit(inspect_doc(doc_files))
def setup(app):
app.connect('builder-inited', inspect_doc)

View File

@ -22,12 +22,17 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import sys
from nova.version import version_info
sys.path.insert(0, os.path.abspath('../'))
extensions = [
'openstackdocstheme',
'os_api_ref',
'ext.validator',
]
# -- General configuration ----------------------------------------------------

View File

@ -198,8 +198,6 @@ description =
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
# Check that all placement api routes are in the documentation
python tools/placement_api_docs.py placement-api-ref/source/
rm -rf placement-api-ref/build
sphinx-build -W -b html -d placement-api-ref/build/doctrees placement-api-ref/source placement-api-ref/build/html