1+ from distutils .version import LooseVersion
12import os .path as op
23import re
34import shutil
45
56import pytest
7+ import sphinx
68from sphinx .application import Sphinx
79from sphinx .util .docutils import docutils_namespace
810
@@ -25,9 +27,12 @@ def ignore(src, names):
2527 toctrees_dir = op .join (temp_dir , '_build' , 'toctrees' )
2628 # Avoid warnings about re-registration, see:
2729 # https://github.com/sphinx-doc/sphinx/issues/5038
30+ kwargs = dict ()
31+ if LooseVersion (sphinx .__version__ ) >= LooseVersion ('1.8' ):
32+ kwargs .update (warningiserror = True , keep_going = True )
2833 with docutils_namespace ():
2934 app = Sphinx (src_dir , conf_dir , out_dir , toctrees_dir ,
30- buildername = 'html' )
35+ buildername = 'html' , ** kwargs )
3136 # need to build within the context manager
3237 # for automodule and backrefs to work
3338 app .build (False , [])
@@ -46,6 +51,9 @@ def test_MyClass(sphinx_app):
4651 'numpydoc_test_module.MyClass.html' )
4752 with open (class_html , 'r' ) as fid :
4853 html = fid .read ()
54+ # ensure that no autodoc weirdness ($) occurs
55+ assert '$self' not in html
56+ assert '__init__' in html # inherited
4957 # escaped * chars should no longer be preceded by \'s,
5058 # if we see a \* in the output we know it's incorrect:
5159 assert r'\*' not in html
@@ -77,7 +85,7 @@ def test_reference(sphinx_app):
7785 ["generated" , "numpydoc_test_module.MyClass.html" ],
7886 ]
7987
80- expected_lengths = [3 , 1 , 1 ]
88+ expected_lengths = [1 , 1 , 1 ]
8189
8290 for html_file , expected_length in zip (html_files , expected_lengths ):
8391 html_file = op .join (out_dir , * html_file )
0 commit comments