tests: Support Sphinx 1.8+

Change-Id: I6ba49b94c6a029746fb284a7e8e7f70c1f070de8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2018-10-04 16:13:01 +01:00
parent 26fc4a3f29
commit fd9f284292
1 changed files with 15 additions and 0 deletions

View File

@ -18,11 +18,26 @@ Tests for `os_api_ref` module.
"""
from bs4 import BeautifulSoup
import sphinx
from sphinx_testing import with_app
from os_api_ref.tests import base
# FIXME(stephenfin): This is horrible. We're monkeypatching this to work around
# the fact that Sphinx 1.8+ started called 'abspath' from within the
# 'sphinx.application.Application' class [1]. This means our careful use of
# 'sphinx_testing.path.path' for 'Application.outdir' etc. gets stomped on.
# We're correcting that but we're doing so globally because mock doesn't work
# for some reason and this is bound to have some side effects
#
# [1] https://github.com/sphinx-doc/sphinx/commit/3a85b3502f
try:
sphinx.application.abspath = lambda x: x
except ImportError: # Sphinx < 1.8
pass
class TestBasicExample(base.TestCase):
"""Test basic rendering.