From fd9f284292d4b50ba4108ff8d8053b0d70bf0188 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 4 Oct 2018 16:13:01 +0100 Subject: [PATCH] tests: Support Sphinx 1.8+ Change-Id: I6ba49b94c6a029746fb284a7e8e7f70c1f070de8 Signed-off-by: Stephen Finucane --- os_api_ref/tests/test_basic_example.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/os_api_ref/tests/test_basic_example.py b/os_api_ref/tests/test_basic_example.py index 48af559..dc89bae 100644 --- a/os_api_ref/tests/test_basic_example.py +++ b/os_api_ref/tests/test_basic_example.py @@ -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.