From 0a4764f7b75d8627f15a0e9f5d16453cd1cb86e6 Mon Sep 17 00:00:00 2001 From: Stephen Balukoff Date: Thu, 8 Sep 2016 14:53:01 -0700 Subject: [PATCH] Update tox 'docs' environment to test specs This commit updates the tox 'docs' environment to also run our specs tests, so that the existing docs gate merge jobs will catch any specs that get added but don't follow the template. This commit also updates the specs test to suppress warnings for :doc: references in specs. Change-Id: Ie7dda124a0c964712b1a02b55730a76fa346111e Closes-Bug: #1621648 --- specs-tests/test_titles.py | 7 +++++++ tox.ini | 2 ++ 2 files changed, 9 insertions(+) diff --git a/specs-tests/test_titles.py b/specs-tests/test_titles.py index c5815bc8c9..f33bd02a08 100644 --- a/specs-tests/test_titles.py +++ b/specs-tests/test_titles.py @@ -15,6 +15,7 @@ import glob import docutils.core from docutils.parsers import rst from docutils.parsers.rst import directives +from docutils.parsers.rst import roles import testtools @@ -25,11 +26,17 @@ class FakeDirective(rst.Directive): return [] +def fake_role(name, rawtext, text, lineno, inliner, + options=None, content=None): + return [], [] + + directives.register_directive('seqdiag', FakeDirective) directives.register_directive('blockdiag', FakeDirective) directives.register_directive('nwdiag', FakeDirective) directives.register_directive('actdiag', FakeDirective) directives.register_directive('graphviz', FakeDirective) +roles.register_local_role('doc', fake_role) class TestTitles(testtools.TestCase): diff --git a/tox.ini b/tox.ini index 7a9ac442b8..85d4e1d387 100644 --- a/tox.ini +++ b/tox.ini @@ -46,6 +46,8 @@ commands = flake8 [testenv:docs] commands = python setup.py build_sphinx + find . -type f -name "*.pyc" -delete + python -m unittest specs-tests.test_titles [testenv:venv] commands = {posargs}