Close #6712: Allow not to install sphinx.testing as runtime (for ALT Linux)

To follow ALT Linux's policy, this enables to work Sphinx without
sphinx.testing package.
This commit is contained in:
Takeshi KOMIYA
2019-10-11 02:00:47 +09:00
parent 2d609ddf58
commit fc6f8fac83
2 changed files with 8 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ Bugs fixed
* #6704: linkcheck: Be defensive and handle newly defined HTTP error code
* #6655: image URLs containing ``data:`` causes gettext builder crashed
* #6584: i18n: Error when compiling message catalogs on Hindi
* #6712: Allow not to install sphinx.testing as runtime (mainly for ALT Linux)
Testing
--------

View File

@@ -22,7 +22,12 @@ from os import path
from typing import Any, Generator, Iterator, List, Tuple
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
from sphinx.testing.path import path as Path
try:
# for ALT Linux (#6712)
from sphinx.testing.path import path as Path
except ImportError:
Path = None # type: ignore
if False:
# For type annotation
@@ -178,7 +183,7 @@ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
def abspath(pathdir: str) -> str:
if isinstance(pathdir, Path):
if Path is not None and isinstance(pathdir, Path):
return pathdir.abspath()
else:
pathdir = path.abspath(pathdir)