Add support for Sphinx v2.1

Come a new Sphinx version, come new breakages. This one is because of
commit 107c20a11f [1], which changed the default centering style of
tables.

[1] https://github.com/sphinx-doc/sphinx/commit/107c20a11f

Change-Id: I1155300828ad0012bd80b7615a0baca121c5e72e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2019-06-24 16:07:20 +01:00
parent f8557cb63d
commit 2a3f53494d
2 changed files with 11 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ class TestBasicExample(base.TestCase):
# TODO(stephenfin): Drop support for this once we drop support for both # TODO(stephenfin): Drop support for this once we drop support for both
# Python 2.7 and Sphinx < 2.0, likely in "U" # Python 2.7 and Sphinx < 2.0, likely in "U"
if sphinx.version_info >= (2, 0, 0): if sphinx.version_info >= (2, 0, 0):
table = """<table class="docutils align-center"> table = """<table class="docutils align-{}">
<colgroup> <colgroup>
<col style="width: 20%"/> <col style="width: 20%"/>
<col style="width: 10%"/> <col style="width: 10%"/>
@@ -115,7 +115,8 @@ class TestBasicExample(base.TestCase):
<td><p>The name of things</p></td> <td><p>The name of things</p></td>
</tr> </tr>
</tbody> </tbody>
</table>""" </table>""".format('center' if sphinx.version_info < (2, 1, 0)
else 'default')
else: else:
table = """<table border="1" class="docutils"> table = """<table border="1" class="docutils">
<colgroup> <colgroup>
@@ -147,7 +148,7 @@ class TestBasicExample(base.TestCase):
# TODO(stephenfin): Drop support for this once we drop support for both # TODO(stephenfin): Drop support for this once we drop support for both
# Python 2.7 and Sphinx < 2.0, likely in "U" # Python 2.7 and Sphinx < 2.0, likely in "U"
if sphinx.version_info >= (2, 0, 0): if sphinx.version_info >= (2, 0, 0):
success_table = """<table class="docutils align-center"> success_table = """<table class="docutils align-{}">
<colgroup> <colgroup>
<col style="width: 30%"/> <col style="width: 30%"/>
<col style="width: 70%"/> <col style="width: 70%"/>
@@ -168,9 +169,10 @@ class TestBasicExample(base.TestCase):
<td><p>Resource was created and is ready to use.</p></td> <td><p>Resource was created and is ready to use.</p></td>
</tr> </tr>
</tbody> </tbody>
</table>""" </table>""".format('center' if sphinx.version_info < (2, 1, 0)
else 'default')
error_table = """<table class="docutils align-center"> error_table = """<table class="docutils align-{}">
<colgroup> <colgroup>
<col style="width: 30%"/> <col style="width: 30%"/>
<col style="width: 70%"/> <col style="width: 70%"/>
@@ -200,7 +202,8 @@ class TestBasicExample(base.TestCase):
<td><p>There is already a zone with this name.</p></td> <td><p>There is already a zone with this name.</p></td>
</tr> </tr>
</tbody> </tbody>
</table>""" </table>""".format('center' if sphinx.version_info < (2, 1, 0)
else 'default')
else: else:
success_table = """table border="1" class="docutils"> success_table = """table border="1" class="docutils">
<colgroup> <colgroup>

View File

@@ -58,7 +58,7 @@ class TestMicroversions(base.TestCase):
"""Test that min / max mv css class attributes are set in params""" """Test that min / max mv css class attributes are set in params"""
if sphinx.version_info >= (2, 0, 0): if sphinx.version_info >= (2, 0, 0):
table = """<div class="api-detail collapse section" id="list-servers-detail"> table = """<div class="api-detail collapse section" id="list-servers-detail">
<table class="docutils align-center"> <table class="docutils align-{}">
<colgroup> <colgroup>
<col style="width: 20%"/> <col style="width: 20%"/>
<col style="width: 10%"/> <col style="width: 10%"/>
@@ -95,7 +95,7 @@ class TestMicroversions(base.TestCase):
</tbody> </tbody>
</table> </table>
</div> </div>
""" # noqa """.format('center' if sphinx.version_info < (2, 1, 0) else 'default') # noqa
else: else:
table = """<div class="api-detail collapse section" id="list-servers-detail"> table = """<div class="api-detail collapse section" id="list-servers-detail">
<table border="1" class="docutils"> <table border="1" class="docutils">