Use blank testroot for `restructuredtext.parse()`

This commit is contained in:
Adam Turner 2025-02-11 01:11:19 +00:00
parent ebec42c02b
commit c069960e8a
16 changed files with 93 additions and 93 deletions

View File

View File

View File

@ -57,7 +57,7 @@ def test_object_description_sections(app):
assert doctree[1][1][0][1][0] == 'Lorem ipsum dolar sit amet'
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_object_description_content_line_number(app):
text = '.. py:function:: foo(bar)\n\n Some link here: :ref:`abc`\n'
doc = restructuredtext.parse(app, text)

View File

@ -9,7 +9,7 @@ from sphinx.testing import restructuredtext
from sphinx.testing.util import assert_node
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_code_directive(app):
# normal case
text = '.. code::\n\n print("hello world")\n'
@ -89,7 +89,7 @@ def test_csv_table_directive(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_math_directive(app):
# normal case
text = '.. math:: E = mc^2'

View File

@ -765,7 +765,7 @@ def test_domain_c_build_anon_dup_decl(app):
assert 'WARNING: c:identifier reference target not found: @b' in ws[1]
@pytest.mark.sphinx('html', testroot='root', confoverrides={'nitpicky': True})
@pytest.mark.sphinx('html', testroot='_blank', confoverrides={'nitpicky': True})
def test_domain_c_build_semicolon(app):
text = """
.. c:member:: int member;
@ -875,7 +875,7 @@ _var c:member 1 index.html#c.$ -
assert len(ws) == 0
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_c_parse_cfunction(app):
text = (
'.. c:function:: PyObject* '
@ -895,7 +895,7 @@ def test_domain_c_parse_cfunction(app):
assert entry == ('index', 'c.PyType_GenericAlloc', 'function')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_c_parse_cmember(app):
text = '.. c:member:: PyObject* PyTypeObject.tp_bases'
doctree = restructuredtext.parse(app, text)
@ -912,7 +912,7 @@ def test_domain_c_parse_cmember(app):
assert entry == ('index', 'c.PyTypeObject.tp_bases', 'member')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_c_parse_cvar(app):
text = '.. c:var:: PyObject* PyClass_Type'
doctree = restructuredtext.parse(app, text)
@ -929,7 +929,7 @@ def test_domain_c_parse_cvar(app):
assert entry == ('index', 'c.PyClass_Type', 'member')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_c_parse_no_index_entry(app):
text = '.. c:function:: void f()\n.. c:function:: void g()\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
@ -944,7 +944,7 @@ def test_domain_c_parse_no_index_entry(app):
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'c_maximum_signature_line_length': len('str hello(str name)'),
},
@ -1005,7 +1005,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_equal(app):
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'c_maximum_signature_line_length': len('str hello(str name)'),
},
@ -1066,7 +1066,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_force_single(a
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'c_maximum_signature_line_length': len('str hello(str name)'),
},
@ -1125,7 +1125,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_break(app):
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'maximum_signature_line_length': len('str hello(str name)'),
},
@ -1186,7 +1186,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_equal(app):
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'maximum_signature_line_length': len('str hello(str name)'),
},
@ -1247,7 +1247,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_force_single(app
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'maximum_signature_line_length': len('str hello(str name)'),
},
@ -1306,7 +1306,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_break(app):
@pytest.mark.sphinx(
'html',
testroot='root',
testroot='_blank',
confoverrides={
'c_maximum_signature_line_length': len('str hello(str name)'),
'maximum_signature_line_length': 1,

View File

@ -1909,7 +1909,7 @@ _var cpp:member 1 index.html#_CPPv44$ -
assert len(ws) == 0
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_cpp_parse_no_index_entry(app):
text = (
'.. cpp:function:: void f()\n.. cpp:function:: void g()\n :no-index-entry:\n'
@ -1924,7 +1924,7 @@ def test_domain_cpp_parse_no_index_entry(app):
assert_node(doctree[2], addnodes.index, entries=[])
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_domain_cpp_parse_mix_decl_duplicate(app):
# Issue 8270
text = '.. cpp:struct:: A\n.. cpp:function:: void A()\n.. cpp:struct:: A\n'

View File

@ -201,7 +201,7 @@ def test_get_full_qualified_name():
assert domain.get_full_qualified_name(node) == 'module1.Class.func'
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_js_module(app):
text = '.. js:module:: sphinx'
doctree = restructuredtext.parse(app, text)
@ -214,7 +214,7 @@ def test_js_module(app):
assert_node(doctree[1], nodes.target, ids=['module-sphinx'])
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_js_function(app):
text = '.. js:function:: sum(a, b)'
doctree = restructuredtext.parse(app, text)
@ -254,7 +254,7 @@ def test_js_function(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_js_class(app):
text = '.. js:class:: Application'
doctree = restructuredtext.parse(app, text)
@ -289,7 +289,7 @@ def test_js_class(app):
assert_node(doctree[1], addnodes.desc, domain='js', objtype='class', no_index=False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_js_data(app):
text = '.. js:data:: name'
doctree = restructuredtext.parse(app, text)
@ -314,7 +314,7 @@ def test_js_data(app):
assert_node(doctree[1], addnodes.desc, domain='js', objtype='data', no_index=False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_no_index_entry(app):
text = '.. js:function:: f()\n.. js:function:: g()\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
@ -346,7 +346,7 @@ def test_no_index_entry(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_module_content_line_number(app):
text = '.. js:module:: foo\n\n Some link here: :ref:`abc`\n'
doc = restructuredtext.parse(app, text)

View File

@ -344,7 +344,7 @@ def test_get_full_qualified_name():
assert domain.get_full_qualified_name(node) == 'module1.Class.func'
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_parse_annotation(app):
doctree = _parse_annotation('int', app.env)
assert_node(doctree, ([pending_xref, 'int'],))
@ -504,7 +504,7 @@ def test_parse_annotation(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_parse_annotation_suppress(app):
doctree = _parse_annotation('~typing.Dict[str, str]', app.env)
assert_node(
@ -524,7 +524,7 @@ def test_parse_annotation_suppress(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_parse_annotation_Literal(app):
doctree = _parse_annotation('Literal[True, False]', app.env)
assert_node(
@ -814,7 +814,7 @@ def test_modindex_common_prefix(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_no_index_entry(app):
text = '.. py:function:: f()\n.. py:function:: g()\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
@ -1209,7 +1209,7 @@ def test_domain_py_python_trailing_comma_in_multi_line_signatures_in_text(app):
assert expected_parameter_list_foo in content
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_module_content_line_number(app):
text = '.. py:module:: foo\n\n Some link here: :ref:`abc`\n'
doc = restructuredtext.parse(app, text)
@ -1325,7 +1325,7 @@ def test_short_literal_types(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_function_pep_695(app):
text = """.. py:function:: func[\
S,\
@ -1452,7 +1452,7 @@ def test_function_pep_695(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_class_def_pep_695(app):
# Non-concrete unbound generics are allowed at runtime but type checkers
# should fail (https://peps.python.org/pep-0695/#type-parameter-scopes)
@ -1508,7 +1508,7 @@ def test_class_def_pep_695(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_class_def_pep_696(app):
# test default values for type variables without using PEP 696 AST parser
text = """.. py:class:: Class[\

View File

@ -36,7 +36,7 @@ def test_domain_py_canonical(app):
assert app.warning.getvalue() == ''
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_canonical(app):
text = '.. py:class:: io.StringIO\n :canonical: _io.StringIO'
domain = app.env.domains.python_domain
@ -69,7 +69,7 @@ def test_canonical(app):
assert domain.objects['_io.StringIO'] == ('index', 'io.StringIO', 'class', True)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_canonical_definition_overrides(app):
text = (
'.. py:class:: io.StringIO\n'
@ -83,7 +83,7 @@ def test_canonical_definition_overrides(app):
assert domain.objects['_io.StringIO'] == ('index', 'id0', 'class', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_canonical_definition_skip(app):
text = (
'.. py:class:: _io.StringIO\n'
@ -98,7 +98,7 @@ def test_canonical_definition_skip(app):
assert domain.objects['_io.StringIO'] == ('index', 'io.StringIO', 'class', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_canonical_duplicated(app):
text = (
'.. py:class:: mypackage.StringIO\n'

View File

@ -22,7 +22,7 @@ from sphinx.testing import restructuredtext
from sphinx.testing.util import assert_node
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list(app):
text = (
'.. py:module:: example\n'
@ -201,7 +201,7 @@ def test_info_field_list(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list_piped_type(app):
text = (
'.. py:module:: example\n'
@ -278,7 +278,7 @@ def test_info_field_list_piped_type(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list_Literal(app):
text = (
'.. py:module:: example\n'
@ -352,7 +352,7 @@ def test_info_field_list_Literal(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list_var(app):
text = '.. py:class:: Class\n\n :var int attr: blah blah\n'
doctree = restructuredtext.parse(app, text)
@ -391,7 +391,7 @@ def test_info_field_list_var(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list_napoleon_deliminator_of(app):
text = (
'.. py:module:: example\n'
@ -437,7 +437,7 @@ def test_info_field_list_napoleon_deliminator_of(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_info_field_list_napoleon_deliminator_or(app):
text = (
'.. py:module:: example\n'
@ -483,7 +483,7 @@ def test_info_field_list_napoleon_deliminator_or(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_type_field(app):
text = (
'.. py:data:: var1\n'

View File

@ -28,7 +28,7 @@ from sphinx.testing import restructuredtext
from sphinx.testing.util import assert_node
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction(app):
text = (
'.. py:function:: func1\n'
@ -99,7 +99,7 @@ def test_pyfunction(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_signature(app):
text = '.. py:function:: hello(name: str) -> str'
doctree = restructuredtext.parse(app, text)
@ -146,7 +146,7 @@ def test_pyfunction_signature(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_signature_full(app):
text = (
'.. py:function:: hello(a: str, b = 1, *args: str, '
@ -311,7 +311,7 @@ def test_pyfunction_signature_full(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_with_unary_operators(app):
text = '.. py:function:: menu(egg=+1, bacon=-1, sausage=~1, spam=not spam)'
doctree = restructuredtext.parse(app, text)
@ -357,7 +357,7 @@ def test_pyfunction_with_unary_operators(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_with_binary_operators(app):
text = '.. py:function:: menu(spam=2**64)'
doctree = restructuredtext.parse(app, text)
@ -377,7 +377,7 @@ def test_pyfunction_with_binary_operators(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_with_number_literals(app):
text = '.. py:function:: hello(age=0x10, height=1_6_0)'
doctree = restructuredtext.parse(app, text)
@ -407,7 +407,7 @@ def test_pyfunction_with_number_literals(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyfunction_with_union_type_operator(app):
text = '.. py:function:: hello(age: int | None)'
doctree = restructuredtext.parse(app, text)
@ -437,7 +437,7 @@ def test_pyfunction_with_union_type_operator(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_optional_pyfunction_signature(app):
text = '.. py:function:: compile(source [, filename [, symbol]]) -> ast object'
doctree = restructuredtext.parse(app, text)

View File

@ -23,7 +23,7 @@ from sphinx.testing import restructuredtext
from sphinx.testing.util import assert_node
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyexception_signature(app):
text = '.. py:exception:: builtins.IOError'
doctree = restructuredtext.parse(app, text)
@ -60,7 +60,7 @@ def test_pyexception_signature(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydata_signature(app):
text = '.. py:data:: version\n :type: int\n :value: 1\n'
doctree = restructuredtext.parse(app, text)
@ -109,7 +109,7 @@ def test_pydata_signature(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydata_signature_old(app):
text = '.. py:data:: version\n :annotation: = 1\n'
doctree = restructuredtext.parse(app, text)
@ -142,7 +142,7 @@ def test_pydata_signature_old(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydata_with_union_type_operator(app):
text = '.. py:data:: version\n :type: int | str'
doctree = restructuredtext.parse(app, text)
@ -166,7 +166,7 @@ def test_pydata_with_union_type_operator(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyobject_prefix(app):
text = (
'.. py:class:: Foo\n\n .. py:method:: Foo.say\n .. py:method:: FooBar.say'
@ -200,7 +200,7 @@ def test_pyobject_prefix(app):
assert doctree[1][1][3].astext().strip() == 'FooBar.say()'
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydata(app):
text = '.. py:module:: example\n.. py:data:: var\n :type: int\n'
domain = app.env.domains.python_domain
@ -239,7 +239,7 @@ def test_pydata(app):
assert domain.objects['example.var'] == ('index', 'example.var', 'data', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyclass_options(app):
text = '.. py:class:: Class1\n.. py:class:: Class2\n :final:\n'
domain = app.env.domains.python_domain
@ -308,7 +308,7 @@ def test_pyclass_options(app):
assert domain.objects['Class2'] == ('index', 'Class2', 'class', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pymethod_options(app):
text = (
'.. py:class:: Class\n'
@ -504,7 +504,7 @@ def test_pymethod_options(app):
assert domain.objects['Class.meth6'] == ('index', 'Class.meth6', 'method', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyclassmethod(app):
text = '.. py:class:: Class\n\n .. py:classmethod:: meth\n'
domain = app.env.domains.python_domain
@ -557,7 +557,7 @@ def test_pyclassmethod(app):
assert domain.objects['Class.meth'] == ('index', 'Class.meth', 'method', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pystaticmethod(app):
text = '.. py:class:: Class\n\n .. py:staticmethod:: meth\n'
domain = app.env.domains.python_domain
@ -607,7 +607,7 @@ def test_pystaticmethod(app):
assert domain.objects['Class.meth'] == ('index', 'Class.meth', 'method', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyattribute(app):
text = (
'.. py:class:: Class\n'
@ -684,7 +684,7 @@ def test_pyattribute(app):
assert domain.objects['Class.attr'] == ('index', 'Class.attr', 'attribute', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pyproperty(app):
text = (
'.. py:class:: Class\n'
@ -795,7 +795,7 @@ def test_pyproperty(app):
assert domain.objects['Class.prop2'] == ('index', 'Class.prop2', 'property', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_py_type_alias(app):
text = (
'.. py:module:: example\n'
@ -940,7 +940,7 @@ def test_domain_py_type_alias(app):
assert app.warning.getvalue() == ''
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydecorator_signature(app):
text = '.. py:decorator:: deco'
domain = app.env.domains.python_domain
@ -971,7 +971,7 @@ def test_pydecorator_signature(app):
assert domain.objects['deco'] == ('index', 'deco', 'function', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pydecoratormethod_signature(app):
text = '.. py:decoratormethod:: deco'
domain = app.env.domains.python_domain
@ -1002,7 +1002,7 @@ def test_pydecoratormethod_signature(app):
assert domain.objects['deco'] == ('index', 'deco', 'method', False)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_pycurrentmodule(app):
text = (
'.. py:module:: Other\n'

View File

@ -32,7 +32,7 @@ def test_parse_directive():
assert s == ('.. :: bar', '')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive(app):
# bare
text = '.. rst:directive:: toctree'
@ -81,7 +81,7 @@ def test_rst_directive(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive_with_argument(app):
text = '.. rst:directive:: .. toctree:: foo bar baz'
doctree = restructuredtext.parse(app, text)
@ -115,7 +115,7 @@ def test_rst_directive_with_argument(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive_option(app):
text = '.. rst:directive:option:: foo'
doctree = restructuredtext.parse(app, text)
@ -142,7 +142,7 @@ def test_rst_directive_option(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive_option_with_argument(app):
text = '.. rst:directive:option:: foo: bar baz'
doctree = restructuredtext.parse(app, text)
@ -178,7 +178,7 @@ def test_rst_directive_option_with_argument(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive_option_type(app):
text = '.. rst:directive:option:: foo\n :type: directives.flags\n'
doctree = restructuredtext.parse(app, text)
@ -217,7 +217,7 @@ def test_rst_directive_option_type(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_directive_and_directive_option(app):
text = '.. rst:directive:: foo\n\n .. rst:directive:option:: bar\n'
doctree = restructuredtext.parse(app, text)
@ -259,7 +259,7 @@ def test_rst_directive_and_directive_option(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_rst_role(app):
text = '.. rst:role:: ref'
doctree = restructuredtext.parse(app, text)

View File

@ -89,7 +89,7 @@ def test_get_full_qualified_name():
assert domain.get_full_qualified_name(node) == 'ls.-l'
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_cmd_option_with_optional_value(app):
text = '.. option:: -j[=N]'
doctree = restructuredtext.parse(app, text)
@ -116,7 +116,7 @@ def test_cmd_option_with_optional_value(app):
assert ('-j', '-j', 'cmdoption', 'index', 'cmdoption-j', 1) in objects
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_cmd_option_starting_with_bracket(app):
text = '.. option:: [enable=]PATTERN'
doctree = restructuredtext.parse(app, text)
@ -147,7 +147,7 @@ def test_cmd_option_starting_with_bracket(app):
) in objects
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary(app):
text = (
'.. glossary::\n'
@ -243,7 +243,7 @@ def test_glossary(app):
assert_node(refnode, nodes.reference, refid='term-TERM2')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_warning(app):
# empty line between terms
text = '.. glossary::\n\n term1\n\n term2\n'
@ -275,7 +275,7 @@ def test_glossary_warning(app):
) in app.warning.getvalue()
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_comment(app):
text = (
'.. glossary::\n'
@ -301,7 +301,7 @@ def test_glossary_comment(app):
assert_node(doctree[0][0][0][1], [nodes.definition, nodes.paragraph, 'description'])
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_comment2(app):
text = (
'.. glossary::\n'
@ -335,7 +335,7 @@ def test_glossary_comment2(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_sorted(app):
text = (
'.. glossary::\n'
@ -373,7 +373,7 @@ def test_glossary_sorted(app):
assert_node(doctree[0][0][1][1], [nodes.definition, nodes.paragraph, 'description'])
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_alphanumeric(app):
text = '.. glossary::\n\n 1\n /\n'
restructuredtext.parse(app, text)
@ -382,7 +382,7 @@ def test_glossary_alphanumeric(app):
assert ('/', '/', 'term', 'index', 'term-0', -1) in objects
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_glossary_conflicted_labels(app):
text = '.. _term-foo:\n.. glossary::\n\n foo\n'
restructuredtext.parse(app, text)
@ -390,7 +390,7 @@ def test_glossary_conflicted_labels(app):
assert ('foo', 'foo', 'term', 'index', 'term-0', -1) in objects
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_cmdoption(app):
text = '.. program:: ls\n\n.. option:: -l\n'
domain = app.env.domains.standard_domain
@ -417,7 +417,7 @@ def test_cmdoption(app):
assert domain.progoptions['ls', '-l'] == ('index', 'cmdoption-ls-l')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_cmdoption_for_None(app):
text = '.. program:: ls\n.. program:: None\n\n.. option:: -l\n'
domain = app.env.domains.standard_domain
@ -444,7 +444,7 @@ def test_cmdoption_for_None(app):
assert domain.progoptions[None, '-l'] == ('index', 'cmdoption-l')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_multiple_cmdoptions(app):
text = '.. program:: cmd\n\n.. option:: -o directory, --output directory\n'
domain = app.env.domains.standard_domain
@ -485,7 +485,7 @@ def test_multiple_cmdoptions(app):
assert domain.progoptions['cmd', '--output'] == ('index', 'cmdoption-cmd-o')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_disabled_docref(app):
text = ':doc:`index`\n:doc:`!index`\n'
doctree = restructuredtext.parse(app, text)
@ -500,7 +500,7 @@ def test_disabled_docref(app):
)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_labeled_rubric(app):
text = '.. _label:\n.. rubric:: blah *blah* blah\n'
restructuredtext.parse(app, text)
@ -510,7 +510,7 @@ def test_labeled_rubric(app):
assert domain.labels['label'] == ('index', 'label', 'blah blah blah')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_labeled_definition(app):
text = (
'.. _label1:\n'
@ -533,7 +533,7 @@ def test_labeled_definition(app):
assert domain.labels['label2'] == ('index', 'label2', 'Bar blah blah blah')
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_labeled_field(app):
text = (
'.. _label1:\n'

View File

@ -17,7 +17,7 @@ def test_ifconfig(app):
assert 'ham' not in result
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_ifconfig_content_line_number(app):
app.setup_extension('sphinx.ext.ifconfig')
text = '.. ifconfig:: confval1\n\n Some link here: :ref:`abc`\n'

View File

@ -10,7 +10,7 @@ from sphinx.testing import restructuredtext
from sphinx.testing.util import assert_node
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_transforms_reorder_consecutive_target_and_index_nodes_preserve_order(app):
text = '.. index:: abc\n.. index:: def\n.. index:: ghi\n.. index:: jkl\n\ntext\n'
doctree = restructuredtext.parse(app, text)
@ -47,7 +47,7 @@ def test_transforms_reorder_consecutive_target_and_index_nodes_preserve_order(ap
# assert_node(doctree[8], nodes.paragraph)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_transforms_reorder_consecutive_target_and_index_nodes_no_merge_across_other_nodes(
app,
):
@ -98,7 +98,7 @@ def test_transforms_reorder_consecutive_target_and_index_nodes_no_merge_across_o
# assert_node(doctree[9], nodes.paragraph)
@pytest.mark.sphinx('html', testroot='root')
@pytest.mark.sphinx('html', testroot='_blank')
def test_transforms_reorder_consecutive_target_and_index_nodes_merge_with_labels(app):
text = (
'.. _abc:\n'