Fix sphinx.testing uses deprecated pytest API; Node.get_marker(name)

This commit is contained in:
Takeshi KOMIYA 2018-06-01 14:39:43 +09:00
parent 88cbd6a597
commit fb41dcefab
4 changed files with 17 additions and 4 deletions

View File

@ -17,6 +17,7 @@ Bugs fixed
---------- ----------
* #5037: LaTeX ``\sphinxupquote{}`` breaks in Russian * #5037: LaTeX ``\sphinxupquote{}`` breaks in Russian
* sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)``
Testing Testing
-------- --------

View File

@ -39,6 +39,9 @@ def app_params(request, test_params, shared_result, sphinx_test_tempdir, rootdir
# ##### process pytest.mark.sphinx # ##### process pytest.mark.sphinx
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
markers = request.node.iter_markers("sphinx")
else:
markers = request.node.get_marker("sphinx") markers = request.node.get_marker("sphinx")
pargs = {} pargs = {}
kwargs = {} # type: Dict[str, str] kwargs = {} # type: Dict[str, str]
@ -86,6 +89,9 @@ def test_params(request):
have same 'shared_result' value. have same 'shared_result' value.
**NOTE**: You can not specify shared_result and srcdir in same time. **NOTE**: You can not specify shared_result and srcdir in same time.
""" """
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
env = request.node.get_closest_marker('test_params')
else:
env = request.node.get_marker('test_params') env = request.node.get_marker('test_params')
kwargs = env.kwargs if env else {} kwargs = env.kwargs if env else {}
result = { result = {

View File

@ -32,6 +32,9 @@ def apidoc(rootdir, tempdir, apidoc_params):
@pytest.fixture @pytest.fixture
def apidoc_params(request): def apidoc_params(request):
if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
markers = request.node.iter_markers("apidoc")
else:
markers = request.node.get_marker("apidoc") markers = request.node.get_marker("apidoc")
pargs = {} pargs = {}
kwargs = {} kwargs = {}

View File

@ -27,6 +27,9 @@ def setup_command(request, tempdir, rootdir):
Run `setup.py build_sphinx` with args and kwargs, Run `setup.py build_sphinx` with args and kwargs,
pass it to the test and clean up properly. pass it to the test and clean up properly.
""" """
if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
marker = request.node.get_closest_marker('setup_command')
else:
marker = request.node.get_marker('setup_command') marker = request.node.get_marker('setup_command')
args = marker.args if marker else [] args = marker.args if marker else []