refs #3458: add sphinx.testing that are moved from /tests directory.

This commit is contained in:
shimizukawa
2017-05-07 16:46:44 +09:00
parent 0512ebf2d4
commit d497d74370
97 changed files with 535 additions and 452 deletions

View File

@@ -18,19 +18,11 @@ import sphinx
import pytest
from sphinx.util.osutil import cd
from util import rootdir, tempdir
from textwrap import dedent
root = tempdir / 'test-setup'
def setup_module():
if not root.exists():
(rootdir / 'roots' / 'test-setup').copytree(root)
@pytest.fixture
def setup_command(request, tempdir):
def setup_command(request, tempdir, rootdir):
"""
Run `setup.py build_sphinx` with args and kwargs,
pass it to the test and clean up properly.
@@ -38,8 +30,8 @@ def setup_command(request, tempdir):
marker = request.node.get_marker('setup_command')
args = marker.args if marker else []
pkgrootdir = tempdir / 'root'
root.copytree(pkgrootdir)
pkgrootdir = tempdir / 'test-setup'
(rootdir / 'test-setup').copytree(pkgrootdir)
with cd(pkgrootdir):
pythonpath = os.path.dirname(os.path.dirname(sphinx.__file__))
@@ -89,7 +81,7 @@ def nonascii_srcdir(request, setup_command):
try:
(srcdir / mb_name).makedirs()
except UnicodeEncodeError:
from path import FILESYSTEMENCODING
from sphinx.testing.path import FILESYSTEMENCODING
pytest.skip(
'non-ASCII filename not supported on this filesystem encoding: '
'%s' % FILESYSTEMENCODING)