Skip to content

Commit 2ab605a

Browse files
authored
Tests: Fix deprecation warning with new sphinx versions (#1105)
* Tests: Fix deprecation warning with new sphinx versions These builders where split in sphinx and the old import path will be removed in the upcoming Sphinx 4 release. This patch requires sphinx 2 so this will be committed into the v2 release. * Fix imports * Use try/except for backwards compatibility
1 parent bc6e9f0 commit 2ab605a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_builders.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
import pytest
44
import sphinx
55
from sphinx import addnodes
6-
from sphinx.builders.html import SingleFileHTMLBuilder, DirectoryHTMLBuilder
6+
try:
7+
# Available from Sphinx 2.0
8+
from sphinx.builders.dirhtml import DirectoryHTMLBuilder
9+
from sphinx.builders.singlehtml import SingleFileHTMLBuilder
10+
except ImportError:
11+
from sphinx.builders.html import (
12+
DirectoryHTMLBuilder,
13+
SingleFileHTMLBuilder,
14+
)
715

816
from .util import build_all
917

0 commit comments

Comments
 (0)