mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Always define the builder and `testroot when using the app` fixtureture (#12775)
This commit is contained in:
@@ -86,7 +86,7 @@ class SphinxTestApp(sphinx.application.Sphinx):
|
||||
|
||||
It is recommended to use::
|
||||
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test(app):
|
||||
app = ...
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ def test_instantiation(
|
||||
assert isinstance(app_, sphinx.application.Sphinx)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_events(app):
|
||||
def empty():
|
||||
pass
|
||||
@@ -75,24 +76,27 @@ def test_events(app):
|
||||
assert app.emit('my_event', *emit_args) == [], 'Callback called when disconnected'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_emit_with_nonascii_name_node(app):
|
||||
node = nodes.section(names=['\u65e5\u672c\u8a9e'])
|
||||
app.emit('my_event', node)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_extensions(app):
|
||||
app.setup_extension('shutil')
|
||||
warning = strip_colors(app.warning.getvalue())
|
||||
assert "extension 'shutil' has no setup() function" in warning
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_extension_in_blacklist(app):
|
||||
app.setup_extension('sphinxjp.themecore')
|
||||
msg = strip_colors(app.warning.getvalue())
|
||||
assert msg.startswith("WARNING: the extension 'sphinxjp.themecore' was")
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='add_source_parser')
|
||||
@pytest.mark.sphinx('html', testroot='add_source_parser')
|
||||
def test_add_source_parser(app):
|
||||
assert set(app.config.source_suffix) == {'.rst', '.test'}
|
||||
|
||||
@@ -106,7 +110,7 @@ def test_add_source_parser(app):
|
||||
assert app.registry.get_source_parsers()['test'].__name__ == 'TestSourceParser'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='extensions')
|
||||
@pytest.mark.sphinx('html', testroot='extensions')
|
||||
def test_add_is_parallel_allowed(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ def test_duplicated_toctree_entry(app):
|
||||
'DO_EPUBCHECK' not in os.environ,
|
||||
reason='Skipped because DO_EPUBCHECK is not set',
|
||||
)
|
||||
@pytest.mark.sphinx('epub')
|
||||
@pytest.mark.sphinx('epub', testroot='root')
|
||||
def test_run_epubcheck(app):
|
||||
app.build()
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ def test_Catalog_duplicated_message():
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'gettext',
|
||||
testroot='root',
|
||||
srcdir='root-gettext',
|
||||
)
|
||||
def test_build_gettext(app):
|
||||
@@ -66,6 +67,7 @@ def test_build_gettext(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'gettext',
|
||||
testroot='root',
|
||||
srcdir='root-gettext',
|
||||
)
|
||||
def test_msgfmt(app):
|
||||
@@ -212,6 +214,7 @@ def test_gettext_custom_output_template(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'gettext',
|
||||
testroot='root',
|
||||
srcdir='root-gettext',
|
||||
confoverrides={'gettext_compact': 'documentation'},
|
||||
)
|
||||
@@ -283,6 +286,7 @@ def test_gettext_prolog_epilog_substitution_excluded(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'gettext',
|
||||
testroot='root',
|
||||
srcdir='gettext',
|
||||
confoverrides={
|
||||
'gettext_compact': False,
|
||||
|
||||
@@ -124,7 +124,7 @@ def test_html4_error(make_app, tmp_path):
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
@pytest.mark.test_params(shared_result='test_build_html_output_docutils18')
|
||||
def test_docutils_output(app, cached_etree_parse, fname, path, check):
|
||||
app.build()
|
||||
@@ -133,6 +133,7 @@ def test_docutils_output(app, cached_etree_parse, fname, path, check):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
parallel=2,
|
||||
)
|
||||
def test_html_parallel(app):
|
||||
@@ -489,6 +490,7 @@ def test_html_baseurl_and_html_file_suffix(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='basic',
|
||||
srcdir='validate_html_extra_path',
|
||||
)
|
||||
@@ -508,6 +510,7 @@ def test_validate_html_extra_path(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='basic',
|
||||
srcdir='validate_html_static_path',
|
||||
)
|
||||
|
||||
@@ -488,6 +488,7 @@ def tail_check(check: str) -> Callable[[Iterable[Element]], Literal[True]]:
|
||||
)
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
tags=['testtag'],
|
||||
confoverrides={'html_context.hckey_co': 'hcval_co'},
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_html_download(app):
|
||||
app.build()
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ def test_html_local_logo(app):
|
||||
assert (app.outdir / '_static/img.png').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='html_scaled_image_link')
|
||||
@pytest.mark.sphinx('html', testroot='html_scaled_image_link')
|
||||
def test_html_scaled_image_link(app):
|
||||
app.build()
|
||||
context = (app.outdir / 'index.html').read_text(encoding='utf8')
|
||||
|
||||
@@ -8,7 +8,7 @@ from tests.test_builders.xpath_html_util import _intradocument_hyperlink_check
|
||||
from tests.test_builders.xpath_util import check_xpath
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_relations(app):
|
||||
app.build(force_all=True)
|
||||
assert app.builder.relations['index'] == [None, None, 'foo']
|
||||
@@ -39,6 +39,7 @@ def test_singlehtml_toctree(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='toctree',
|
||||
srcdir='numbered-toctree',
|
||||
)
|
||||
|
||||
@@ -134,6 +134,7 @@ class RemoteImageHandler(http.server.BaseHTTPRequestHandler):
|
||||
)
|
||||
@pytest.mark.sphinx(
|
||||
'latex',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_build_latex_doc(app, engine, docclass, python_maximum_signature_line_length):
|
||||
@@ -163,7 +164,7 @@ def test_build_latex_doc(app, engine, docclass, python_maximum_signature_line_le
|
||||
compile_latex_document(app, 'sphinxtests.tex', docclass)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex')
|
||||
@pytest.mark.sphinx('latex', testroot='root')
|
||||
def test_writer(app):
|
||||
app.build(force_all=True)
|
||||
result = (app.outdir / 'sphinxtests.tex').read_text(encoding='utf8')
|
||||
@@ -928,7 +929,7 @@ def test_polyglossia_with_language_de_1901(app):
|
||||
assert r'\addto\captionsgerman{\renewcommand{\tablename}{Table.\@{} }}' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex')
|
||||
@pytest.mark.sphinx('latex', testroot='root')
|
||||
def test_footnote(app):
|
||||
app.build(force_all=True)
|
||||
result = (app.outdir / 'sphinxtests.tex').read_text(encoding='utf8')
|
||||
|
||||
@@ -1145,6 +1145,7 @@ class FakeResponse:
|
||||
url = 'http://localhost/'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_limit_rate_default_sleep(app: SphinxTestApp) -> None:
|
||||
worker = HyperlinkAvailabilityCheckWorker(app.config, Queue(), Queue(), {})
|
||||
with mock.patch('time.time', return_value=0.0):
|
||||
@@ -1154,7 +1155,9 @@ def test_limit_rate_default_sleep(app: SphinxTestApp) -> None:
|
||||
assert next_check == 60.0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'linkcheck_rate_limit_timeout': 0.0})
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='root', confoverrides={'linkcheck_rate_limit_timeout': 0.0}
|
||||
)
|
||||
def test_limit_rate_user_max_delay(app: SphinxTestApp) -> None:
|
||||
worker = HyperlinkAvailabilityCheckWorker(app.config, Queue(), Queue(), {})
|
||||
next_check = worker.limit_rate(
|
||||
@@ -1163,6 +1166,7 @@ def test_limit_rate_user_max_delay(app: SphinxTestApp) -> None:
|
||||
assert next_check is None
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_limit_rate_doubles_previous_wait_time(app: SphinxTestApp) -> None:
|
||||
rate_limits = {'localhost': RateLimit(60.0, 0.0)}
|
||||
worker = HyperlinkAvailabilityCheckWorker(app.config, Queue(), Queue(), rate_limits)
|
||||
@@ -1173,7 +1177,9 @@ def test_limit_rate_doubles_previous_wait_time(app: SphinxTestApp) -> None:
|
||||
assert next_check == 120.0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'linkcheck_rate_limit_timeout': 90})
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='root', confoverrides={'linkcheck_rate_limit_timeout': 90}
|
||||
)
|
||||
def test_limit_rate_clips_wait_time_to_max_time(app: SphinxTestApp) -> None:
|
||||
rate_limits = {'localhost': RateLimit(60.0, 0.0)}
|
||||
worker = HyperlinkAvailabilityCheckWorker(app.config, Queue(), Queue(), rate_limits)
|
||||
@@ -1185,7 +1191,9 @@ def test_limit_rate_clips_wait_time_to_max_time(app: SphinxTestApp) -> None:
|
||||
assert app.warning.getvalue() == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'linkcheck_rate_limit_timeout': 90.0})
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='root', confoverrides={'linkcheck_rate_limit_timeout': 90.0}
|
||||
)
|
||||
def test_limit_rate_bails_out_after_waiting_max_time(app: SphinxTestApp) -> None:
|
||||
rate_limits = {'localhost': RateLimit(90.0, 0.0)}
|
||||
worker = HyperlinkAvailabilityCheckWorker(app.config, Queue(), Queue(), rate_limits)
|
||||
@@ -1197,6 +1205,7 @@ def test_limit_rate_bails_out_after_waiting_max_time(app: SphinxTestApp) -> None
|
||||
|
||||
|
||||
@mock.patch('sphinx.util.requests.requests.Session.get_adapter')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_connection_contention(get_adapter, app, capsys):
|
||||
# Create a shared, but limited-size, connection pool
|
||||
import requests
|
||||
|
||||
@@ -7,7 +7,7 @@ from sphinx.builders.manpage import default_man_pages
|
||||
from sphinx.config import Config
|
||||
|
||||
|
||||
@pytest.mark.sphinx('man')
|
||||
@pytest.mark.sphinx('man', testroot='root')
|
||||
def test_all(app):
|
||||
app.build(force_all=True)
|
||||
assert (app.outdir / 'sphinxtests.1').exists()
|
||||
|
||||
@@ -14,7 +14,7 @@ from sphinx.util.docutils import new_document
|
||||
from sphinx.writers.texinfo import TexinfoTranslator
|
||||
|
||||
|
||||
@pytest.mark.sphinx('texinfo')
|
||||
@pytest.mark.sphinx('texinfo', testroot='root')
|
||||
def test_texinfo(app):
|
||||
TexinfoTranslator.ignore_missing_images = True
|
||||
app.build(force_all=True)
|
||||
@@ -81,7 +81,7 @@ def test_default_texinfo_documents():
|
||||
assert default_texinfo_documents(config) == expected
|
||||
|
||||
|
||||
@pytest.mark.sphinx('texinfo')
|
||||
@pytest.mark.sphinx('texinfo', testroot='root')
|
||||
def test_texinfo_escape_id(app):
|
||||
settings = Mock(title='', texinfo_dir_entry='', texinfo_elements={})
|
||||
document = new_document('', settings)
|
||||
@@ -104,7 +104,7 @@ def test_texinfo_footnote(app):
|
||||
assert 'First footnote: @footnote{\nFirst\n}' in output
|
||||
|
||||
|
||||
@pytest.mark.sphinx('texinfo')
|
||||
@pytest.mark.sphinx('texinfo', testroot='root')
|
||||
def test_texinfo_xrefs(app):
|
||||
app.build(force_all=True)
|
||||
output = (app.outdir / 'sphinxtests.texi').read_text(encoding='utf8')
|
||||
|
||||
@@ -14,12 +14,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
def with_text_app(*args: Any, **kw: Any) -> pytest.MarkDecorator:
|
||||
default_kw = {
|
||||
'buildername': 'text',
|
||||
'testroot': 'build-text',
|
||||
}
|
||||
default_kw.update(kw)
|
||||
return pytest.mark.sphinx(*args, **default_kw)
|
||||
return pytest.mark.sphinx(*args, buildername='text', testroot='build-text', **kw)
|
||||
|
||||
|
||||
@with_text_app()
|
||||
|
||||
@@ -7,6 +7,7 @@ import pytest
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
srcdir='test_builder',
|
||||
freshenv=True,
|
||||
)
|
||||
@@ -80,6 +80,7 @@ def test_config_opt_deprecated(recwarn):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='config',
|
||||
confoverrides={
|
||||
'root_doc': 'root',
|
||||
@@ -458,6 +459,8 @@ def test_config_eol(logger, tmp_path):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={'root_doc': 123, 'language': 'foo', 'primary_domain': None},
|
||||
)
|
||||
def test_builtin_conf(app):
|
||||
@@ -603,7 +606,7 @@ nitpick_warnings = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='nitpicky-warnings')
|
||||
@pytest.mark.sphinx('html', testroot='nitpicky-warnings')
|
||||
def test_nitpick_base(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -613,6 +616,7 @@ def test_nitpick_base(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='nitpicky-warnings',
|
||||
confoverrides={
|
||||
'nitpick_ignore': {
|
||||
@@ -629,6 +633,7 @@ def test_nitpick_ignore(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='nitpicky-warnings',
|
||||
confoverrides={
|
||||
'nitpick_ignore_regex': [
|
||||
@@ -643,6 +648,7 @@ def test_nitpick_ignore_regex1(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='nitpicky-warnings',
|
||||
confoverrides={
|
||||
'nitpick_ignore_regex': [
|
||||
@@ -657,6 +663,7 @@ def test_nitpick_ignore_regex2(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='nitpicky-warnings',
|
||||
confoverrides={
|
||||
'nitpick_ignore_regex': [
|
||||
@@ -754,7 +761,7 @@ def source_date_year(request, monkeypatch):
|
||||
yield None
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='copyright-multiline')
|
||||
@pytest.mark.sphinx('html', testroot='copyright-multiline')
|
||||
def test_multi_line_copyright(source_date_year, app, monkeypatch):
|
||||
app.build(force_all=True)
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path):
|
||||
assert reader.lineno_start == 3
|
||||
|
||||
|
||||
@pytest.mark.sphinx # init locale for errors
|
||||
@pytest.mark.sphinx('html', testroot='root') # init locale for errors
|
||||
def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app):
|
||||
options = {'lines': '0,3,5', 'lineno-match': True}
|
||||
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
|
||||
@@ -111,7 +111,7 @@ def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app):
|
||||
reader.read()
|
||||
|
||||
|
||||
@pytest.mark.sphinx # init locale for errors
|
||||
@pytest.mark.sphinx('html', testroot='root') # init locale for errors
|
||||
def test_LiteralIncludeReader_lines_and_lineno_match3(literal_inc_path, app):
|
||||
options = {'lines': '100-', 'lineno-match': True}
|
||||
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
|
||||
|
||||
@@ -54,6 +54,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')
|
||||
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)
|
||||
|
||||
@@ -10,7 +10,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree(app):
|
||||
text = '.. toctree::\n\n foo\n bar/index\n baz\n'
|
||||
|
||||
@@ -24,7 +24,7 @@ def test_toctree(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_relative_toctree(app):
|
||||
text = '.. toctree::\n\n bar_1\n bar_2\n bar_3\n ../quux\n'
|
||||
|
||||
@@ -43,7 +43,7 @@ def test_relative_toctree(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree_urls_and_titles(app):
|
||||
text = (
|
||||
'.. toctree::\n'
|
||||
@@ -67,7 +67,7 @@ def test_toctree_urls_and_titles(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree_glob(app):
|
||||
text = '.. toctree::\n :glob:\n\n *\n'
|
||||
|
||||
@@ -105,7 +105,7 @@ def test_toctree_glob(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree_glob_and_url(app):
|
||||
text = '.. toctree::\n :glob:\n\n https://example.com/?q=sphinx\n'
|
||||
|
||||
@@ -119,7 +119,7 @@ def test_toctree_glob_and_url(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_reversed_toctree(app):
|
||||
text = '.. toctree::\n :reversed:\n\n foo\n bar/index\n baz\n'
|
||||
|
||||
@@ -133,7 +133,7 @@ def test_reversed_toctree(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree_class(app):
|
||||
text = '.. toctree::\n :class: custom-toc\n\n foo\n'
|
||||
app.env.find_files(app.config, app.builder)
|
||||
@@ -142,7 +142,7 @@ def test_toctree_class(app):
|
||||
assert doctree[0].attributes['classes'] == ['toctree-wrapper', 'custom-toc']
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
@pytest.mark.sphinx('html', testroot='toctree-glob')
|
||||
def test_toctree_twice(app):
|
||||
text = '.. toctree::\n\n foo\n foo\n'
|
||||
|
||||
@@ -156,7 +156,7 @@ def test_toctree_twice(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='directive-include')
|
||||
@pytest.mark.sphinx('html', testroot='directive-include')
|
||||
def test_include_include_read_event(app):
|
||||
sources_reported = []
|
||||
|
||||
@@ -189,7 +189,7 @@ def test_include_include_read_event(app):
|
||||
assert (Path('baz/baz.rst'), 'index', '\nBaz was here.') in sources_reported
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='directive-include')
|
||||
@pytest.mark.sphinx('html', testroot='directive-include')
|
||||
def test_include_include_read_event_nested_includes(app):
|
||||
def source_read_handler(_app, _relative_path, _parent_docname, source):
|
||||
text = source[0].replace('#magical', 'amazing')
|
||||
|
||||
@@ -7,6 +7,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_code_directive(app):
|
||||
# normal case
|
||||
text = '.. code::\n\n print("hello world")\n'
|
||||
@@ -39,7 +40,7 @@ def test_code_directive(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='directive-csv-table')
|
||||
@pytest.mark.sphinx('html', testroot='directive-csv-table')
|
||||
def test_csv_table_directive(app):
|
||||
# relative path from current document
|
||||
text = '.. csv-table::\n :file: example.csv\n'
|
||||
@@ -86,6 +87,7 @@ def test_csv_table_directive(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_math_directive(app):
|
||||
# normal case
|
||||
text = '.. math:: E = mc^2'
|
||||
|
||||
@@ -72,6 +72,7 @@ DOMAINS = [
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -84,6 +85,7 @@ def test_object_description_no_typesetting(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_twice(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -102,6 +104,7 @@ def test_object_description_no_typesetting_twice(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_noindex_orig(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -117,6 +120,7 @@ def test_object_description_no_typesetting_noindex_orig(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_noindex(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -139,6 +143,7 @@ def test_object_description_no_typesetting_noindex(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_no_index_entry(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -161,6 +166,7 @@ def test_object_description_no_typesetting_no_index_entry(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_code(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
@@ -191,6 +197,7 @@ def test_object_description_no_typesetting_code(
|
||||
('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'),
|
||||
DOMAINS,
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_object_description_no_typesetting_heading(
|
||||
app, directive, no_index, no_index_entry, sig_f, sig_g, index_g
|
||||
):
|
||||
|
||||
@@ -731,14 +731,14 @@ def extract_role_links(app, filename):
|
||||
return entries
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'index')
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_namespace(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'namespace')
|
||||
@@ -748,7 +748,7 @@ def test_domain_c_build_namespace(app):
|
||||
assert f'id="c.{id_}"' in t
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_anon_dup_decl(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'anon-dup-decl')
|
||||
@@ -757,7 +757,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(confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='root', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_semicolon(app):
|
||||
text = """
|
||||
.. c:member:: int member;
|
||||
@@ -776,7 +776,7 @@ def test_domain_c_build_semicolon(app):
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_function_param_target(app):
|
||||
# the anchor for function parameters should be the function
|
||||
app.build(force_all=True)
|
||||
@@ -789,14 +789,14 @@ def test_domain_c_build_function_param_target(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_ns_lookup(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'ns_lookup')
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-c', confoverrides={'nitpicky': True})
|
||||
def test_domain_c_build_field_role(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'field-role')
|
||||
@@ -811,7 +811,9 @@ def _get_obj(app, queryName):
|
||||
return queryName, 'not', 'found'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-c-intersphinx', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='domain-c-intersphinx', confoverrides={'nitpicky': True}
|
||||
)
|
||||
def test_domain_c_build_intersphinx(tmp_path, app):
|
||||
# a splitting of test_ids_vs_tags0 into the primary directives in a remote project,
|
||||
# and then the references in the test project
|
||||
@@ -865,6 +867,7 @@ _var c:member 1 index.html#c.$ -
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_domain_c_parse_cfunction(app):
|
||||
text = (
|
||||
'.. c:function:: PyObject* '
|
||||
@@ -884,6 +887,7 @@ def test_domain_c_parse_cfunction(app):
|
||||
assert entry == ('index', 'c.PyType_GenericAlloc', 'function')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_domain_c_parse_cmember(app):
|
||||
text = '.. c:member:: PyObject* PyTypeObject.tp_bases'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -900,6 +904,7 @@ def test_domain_c_parse_cmember(app):
|
||||
assert entry == ('index', 'c.PyTypeObject.tp_bases', 'member')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_domain_c_parse_cvar(app):
|
||||
text = '.. c:var:: PyObject* PyClass_Type'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -916,6 +921,7 @@ def test_domain_c_parse_cvar(app):
|
||||
assert entry == ('index', 'c.PyClass_Type', 'member')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_domain_c_parse_no_index_entry(app):
|
||||
text = (
|
||||
'.. c:function:: void f()\n'
|
||||
@@ -934,6 +940,7 @@ def test_domain_c_parse_no_index_entry(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'c_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -994,6 +1001,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_equal(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'c_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -1054,6 +1062,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_force_single(a
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'c_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -1112,6 +1121,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_break(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -1172,6 +1182,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -1232,6 +1243,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_force_single(app
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -1290,6 +1302,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_break(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'c_maximum_signature_line_length': len('str hello(str name)'),
|
||||
'maximum_signature_line_length': 1,
|
||||
|
||||
@@ -1540,7 +1540,7 @@ def filter_warnings(warning: StringIO, file):
|
||||
return res
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_multi_decl_lookup(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'lookup-key-overload')
|
||||
@@ -1550,7 +1550,7 @@ def test_domain_cpp_build_multi_decl_lookup(app):
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_warn_template_param_qualified_name(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'warn-template-param-qualified-name')
|
||||
@@ -1559,14 +1559,14 @@ def test_domain_cpp_build_warn_template_param_qualified_name(app):
|
||||
assert 'WARNING: cpp:type reference target not found: T::U::typeWarn' in ws[1]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_backslash_ok_true(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'backslash')
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_semicolon(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'semicolon')
|
||||
@@ -1574,6 +1574,7 @@ def test_domain_cpp_build_semicolon(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='domain-cpp',
|
||||
confoverrides={'nitpicky': True, 'strip_signature_backslash': True},
|
||||
)
|
||||
@@ -1584,7 +1585,7 @@ def test_domain_cpp_build_backslash_ok_false(app):
|
||||
assert 'WARNING: Parsing of expression failed. Using fallback parser.' in ws[0]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_anon_dup_decl(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'anon-dup-decl')
|
||||
@@ -1593,7 +1594,7 @@ def test_domain_cpp_build_anon_dup_decl(app):
|
||||
assert 'WARNING: cpp:identifier reference target not found: @b' in ws[1]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp')
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp')
|
||||
def test_domain_cpp_build_misuse_of_roles(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'roles-targets-ok')
|
||||
@@ -1653,6 +1654,7 @@ def test_domain_cpp_build_misuse_of_roles(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='domain-cpp',
|
||||
confoverrides={'add_function_parentheses': True},
|
||||
)
|
||||
@@ -1697,6 +1699,7 @@ def test_domain_cpp_build_with_add_function_parentheses_is_True(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='domain-cpp',
|
||||
confoverrides={'add_function_parentheses': False},
|
||||
)
|
||||
@@ -1740,7 +1743,7 @@ def test_domain_cpp_build_with_add_function_parentheses_is_False(app):
|
||||
assert match is not None, f'Pattern not found in any-role.html:\n\t{pattern}'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp')
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp')
|
||||
def test_domain_cpp_build_xref_consistency(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -1808,14 +1811,14 @@ not found in `{test}`
|
||||
assert any_role.classes == texpr_role.content_classes['a'], expect
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_field_role(app):
|
||||
app.build(force_all=True)
|
||||
ws = filter_warnings(app.warning, 'field-role')
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx('html', testroot='domain-cpp', confoverrides={'nitpicky': True})
|
||||
def test_domain_cpp_build_operator_lookup(app):
|
||||
app.builder.build_all()
|
||||
ws = filter_warnings(app.warning, 'operator-lookup')
|
||||
@@ -1832,7 +1835,9 @@ def test_domain_cpp_build_operator_lookup(app):
|
||||
assert ':21: WARNING: cpp:func reference target not found: operator bool' in ws[4]
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='domain-cpp-intersphinx', confoverrides={'nitpicky': True})
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='domain-cpp-intersphinx', confoverrides={'nitpicky': True}
|
||||
)
|
||||
def test_domain_cpp_build_intersphinx(tmp_path, app):
|
||||
origSource = """\
|
||||
.. cpp:class:: _class
|
||||
@@ -1898,6 +1903,7 @@ _var cpp:member 1 index.html#_CPPv44$ -
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_domain_cpp_parse_no_index_entry(app):
|
||||
text = (
|
||||
'.. cpp:function:: void f()\n'
|
||||
@@ -1914,6 +1920,7 @@ def test_domain_cpp_parse_no_index_entry(app):
|
||||
assert_node(doctree[2], addnodes.index, entries=[])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
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'
|
||||
@@ -1934,7 +1941,7 @@ def test_domain_cpp_parse_mix_decl_duplicate(app):
|
||||
# For some reason, using the default testroot of "root" leads to the contents of
|
||||
# `test-root/objects.txt` polluting the symbol table depending on the test
|
||||
# execution order. Using a testroot of "config" seems to avoid that problem.
|
||||
@pytest.mark.sphinx(testroot='config')
|
||||
@pytest.mark.sphinx('html', testroot='config')
|
||||
def test_domain_cpp_normalize_unspecialized_template_args(make_app, app_params):
|
||||
args, kwargs = app_params
|
||||
|
||||
@@ -1983,6 +1990,7 @@ def test_domain_cpp_normalize_unspecialized_template_args(make_app, app_params):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'cpp_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2043,6 +2051,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_equal(app
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'cpp_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2105,6 +2114,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_force_sin
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'cpp_maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2163,6 +2173,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_break(app
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2223,6 +2234,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_equal(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2283,6 +2295,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_force_single(
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('str hello(str name)'),
|
||||
},
|
||||
@@ -2341,6 +2354,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_break(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'cpp_maximum_signature_line_length': len('str hello(str name)'),
|
||||
'maximum_signature_line_length': 1,
|
||||
|
||||
@@ -199,6 +199,7 @@ def test_get_full_qualified_name():
|
||||
assert domain.get_full_qualified_name(node) == 'module1.Class.func'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_js_module(app):
|
||||
text = '.. js:module:: sphinx'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -211,6 +212,7 @@ def test_js_module(app):
|
||||
assert_node(doctree[1], nodes.target, ids=['module-sphinx'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_js_function(app):
|
||||
text = '.. js:function:: sum(a, b)'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -250,6 +252,7 @@ def test_js_function(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_js_class(app):
|
||||
text = '.. js:class:: Application'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -284,6 +287,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')
|
||||
def test_js_data(app):
|
||||
text = '.. js:data:: name'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -308,6 +312,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')
|
||||
def test_no_index_entry(app):
|
||||
text = '.. js:function:: f()\n.. js:function:: g()\n :no-index-entry:\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -320,6 +325,7 @@ def test_no_index_entry(app):
|
||||
assert_node(doctree[2], addnodes.index, entries=[])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_module_content_line_number(app):
|
||||
text = '.. js:module:: foo\n\n Some link here: :ref:`abc`\n'
|
||||
doc = restructuredtext.parse(app, text)
|
||||
@@ -332,6 +338,7 @@ def test_module_content_line_number(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'javascript_maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -375,6 +382,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_equa
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'javascript_maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -420,6 +428,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_forc
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'javascript_maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -463,6 +472,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_brea
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -506,6 +516,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -549,6 +560,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_force_single(ap
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name)'),
|
||||
},
|
||||
@@ -592,6 +604,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_break(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'javascript_maximum_signature_line_length': len('hello(name)'),
|
||||
'maximum_signature_line_length': 1,
|
||||
|
||||
@@ -315,6 +315,7 @@ def test_domain_py_find_obj(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_get_full_qualified_name():
|
||||
env = Mock(domaindata={})
|
||||
domain = PythonDomain(env)
|
||||
@@ -343,6 +344,7 @@ def test_get_full_qualified_name():
|
||||
assert domain.get_full_qualified_name(node) == 'module1.Class.func'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_parse_annotation(app):
|
||||
doctree = _parse_annotation('int', app.env)
|
||||
assert_node(doctree, ([pending_xref, 'int'],))
|
||||
@@ -502,6 +504,7 @@ def test_parse_annotation(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_parse_annotation_suppress(app):
|
||||
doctree = _parse_annotation('~typing.Dict[str, str]', app.env)
|
||||
assert_node(
|
||||
@@ -521,6 +524,7 @@ def test_parse_annotation_suppress(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_parse_annotation_Literal(app):
|
||||
doctree = _parse_annotation('Literal[True, False]', app.env)
|
||||
assert_node(
|
||||
@@ -554,7 +558,7 @@ def test_parse_annotation_Literal(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(freshenv=True)
|
||||
@pytest.mark.sphinx('html', testroot='root', freshenv=True)
|
||||
def test_module_index(app):
|
||||
text = (
|
||||
'.. py:module:: docutils\n'
|
||||
@@ -604,7 +608,7 @@ def test_module_index(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(freshenv=True)
|
||||
@pytest.mark.sphinx('html', testroot='root', freshenv=True)
|
||||
def test_module_index_submodule(app):
|
||||
text = '.. py:module:: sphinx.config\n'
|
||||
restructuredtext.parse(app, text)
|
||||
@@ -625,7 +629,7 @@ def test_module_index_submodule(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(freshenv=True)
|
||||
@pytest.mark.sphinx('html', testroot='root', freshenv=True)
|
||||
def test_module_index_not_collapsed(app):
|
||||
text = '.. py:module:: docutils\n.. py:module:: sphinx\n'
|
||||
restructuredtext.parse(app, text)
|
||||
@@ -640,6 +644,8 @@ def test_module_index_not_collapsed(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
confoverrides={'modindex_common_prefix': ['sphinx.']},
|
||||
)
|
||||
@@ -702,6 +708,7 @@ def test_modindex_common_prefix(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_no_index_entry(app):
|
||||
text = '.. py:function:: f()\n.. py:function:: g()\n :no-index-entry:\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -770,8 +777,8 @@ def test_warn_missing_reference(app):
|
||||
) in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'nitpicky': True})
|
||||
@pytest.mark.parametrize('include_options', [True, False])
|
||||
@pytest.mark.sphinx('html', testroot='root', confoverrides={'nitpicky': True})
|
||||
def test_signature_line_number(app, include_options):
|
||||
text = '.. py:function:: foo(bar : string)\n' + (
|
||||
' :no-index-entry:\n' if include_options else ''
|
||||
@@ -786,6 +793,7 @@ def test_signature_line_number(app, include_options):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'python_maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
'maximum_signature_line_length': 1,
|
||||
@@ -959,6 +967,7 @@ def test_domain_py_python_maximum_signature_line_length_in_text(app):
|
||||
assert expected_parameter_list_foo in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_module_content_line_number(app):
|
||||
text = '.. py:module:: foo\n\n Some link here: :ref:`abc`\n'
|
||||
doc = restructuredtext.parse(app, text)
|
||||
@@ -970,6 +979,8 @@ def test_module_content_line_number(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
confoverrides={'python_display_short_literal_types': True},
|
||||
)
|
||||
@@ -1072,6 +1083,7 @@ def test_short_literal_types(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_function_pep_695(app):
|
||||
text = """.. py:function:: func[\
|
||||
S,\
|
||||
@@ -1198,6 +1210,7 @@ def test_function_pep_695(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
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)
|
||||
@@ -1250,6 +1263,7 @@ def test_class_def_pep_695(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_class_def_pep_696(app):
|
||||
# test default values for type variables without using PEP 696 AST parser
|
||||
text = """.. py:class:: Class[\
|
||||
@@ -1442,6 +1456,7 @@ def test_class_def_pep_696(app):
|
||||
("[T:Annotated[int,ctype('char')]]", "[T: Annotated[int, ctype('char')]]"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pep_695_and_pep_696_whitespaces_in_bound(app, tp_list, tptext):
|
||||
text = f'.. py:function:: f{tp_list}()'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -1455,6 +1470,7 @@ def test_pep_695_and_pep_696_whitespaces_in_bound(app, tp_list, tptext):
|
||||
('[T:(int|str,*Ts)]', '[T: (int | str, *Ts)]'),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pep_695_and_pep_696_whitespaces_in_constraints(app, tp_list, tptext):
|
||||
text = f'.. py:function:: f{tp_list}()'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -1478,6 +1494,7 @@ def test_pep_695_and_pep_696_whitespaces_in_constraints(app, tp_list, tptext):
|
||||
('[**P=[int,A[int,ctype("char")]]]', '[**P = [int, A[int, ctype("char")]]]'),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pep_695_and_pep_696_whitespaces_in_default(app, tp_list, tptext):
|
||||
text = f'.. py:function:: f{tp_list}()'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
|
||||
@@ -35,6 +35,7 @@ def test_domain_py_canonical(app):
|
||||
assert app.warning.getvalue() == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_canonical(app):
|
||||
text = '.. py:class:: io.StringIO\n :canonical: _io.StringIO'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -64,6 +65,7 @@ def test_canonical(app):
|
||||
assert domain.objects['_io.StringIO'] == ('index', 'io.StringIO', 'class', True)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_canonical_definition_overrides(app):
|
||||
text = (
|
||||
'.. py:class:: io.StringIO\n'
|
||||
@@ -77,6 +79,7 @@ def test_canonical_definition_overrides(app):
|
||||
assert domain.objects['_io.StringIO'] == ('index', 'id0', 'class', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_canonical_definition_skip(app):
|
||||
text = (
|
||||
'.. py:class:: _io.StringIO\n'
|
||||
@@ -91,6 +94,7 @@ def test_canonical_definition_skip(app):
|
||||
assert domain.objects['_io.StringIO'] == ('index', 'io.StringIO', 'class', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_canonical_duplicated(app):
|
||||
text = (
|
||||
'.. py:class:: mypackage.StringIO\n'
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
@@ -20,6 +21,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -195,6 +197,7 @@ def test_info_field_list(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list_piped_type(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -268,6 +271,7 @@ def test_info_field_list_piped_type(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list_Literal(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -338,6 +342,7 @@ def test_info_field_list_Literal(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list_var(app):
|
||||
text = '.. py:class:: Class\n\n :var int attr: blah blah\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -376,6 +381,7 @@ def test_info_field_list_var(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list_napoleon_deliminator_of(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -421,6 +427,7 @@ def test_info_field_list_napoleon_deliminator_of(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_field_list_napoleon_deliminator_or(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -466,6 +473,7 @@ def test_info_field_list_napoleon_deliminator_or(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_type_field(app):
|
||||
text = (
|
||||
'.. py:data:: var1\n'
|
||||
|
||||
@@ -28,6 +28,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction(app):
|
||||
text = (
|
||||
'.. py:function:: func1\n'
|
||||
@@ -98,6 +99,7 @@ def test_pyfunction(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction_signature(app):
|
||||
text = '.. py:function:: hello(name: str) -> str'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -144,6 +146,7 @@ def test_pyfunction_signature(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction_signature_full(app):
|
||||
text = (
|
||||
'.. py:function:: hello(a: str, b = 1, *args: str, '
|
||||
@@ -308,6 +311,7 @@ def test_pyfunction_signature_full(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
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)
|
||||
@@ -353,6 +357,7 @@ def test_pyfunction_with_unary_operators(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction_with_binary_operators(app):
|
||||
text = '.. py:function:: menu(spam=2**64)'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -372,6 +377,7 @@ def test_pyfunction_with_binary_operators(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction_with_number_literals(app):
|
||||
text = '.. py:function:: hello(age=0x10, height=1_6_0)'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -401,6 +407,7 @@ def test_pyfunction_with_number_literals(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyfunction_with_union_type_operator(app):
|
||||
text = '.. py:function:: hello(age: int | None)'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -430,6 +437,7 @@ def test_pyfunction_with_union_type_operator(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_optional_pyfunction_signature(app):
|
||||
text = '.. py:function:: compile(source [, filename [, symbol]]) -> ast object'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -478,6 +486,7 @@ def test_optional_pyfunction_signature(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'python_maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
@@ -531,6 +540,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_equal(ap
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'python_maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
@@ -586,6 +596,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_force_si
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'python_maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
@@ -639,6 +650,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_break(ap
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
@@ -692,6 +704,7 @@ def test_pyfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
@@ -745,6 +758,7 @@ def test_pyfunction_signature_with_maximum_signature_line_length_force_single(ap
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='root',
|
||||
confoverrides={
|
||||
'maximum_signature_line_length': len('hello(name: str) -> str'),
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyexception_signature(app):
|
||||
text = '.. py:exception:: builtins.IOError'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -55,6 +56,7 @@ def test_pyexception_signature(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydata_signature(app):
|
||||
text = '.. py:data:: version\n :type: int\n :value: 1\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -103,6 +105,7 @@ def test_pydata_signature(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydata_signature_old(app):
|
||||
text = '.. py:data:: version\n :annotation: = 1\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -135,6 +138,7 @@ def test_pydata_signature_old(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydata_with_union_type_operator(app):
|
||||
text = '.. py:data:: version\n :type: int | str'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -158,6 +162,7 @@ def test_pydata_with_union_type_operator(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyobject_prefix(app):
|
||||
text = (
|
||||
'.. py:class:: Foo\n'
|
||||
@@ -191,6 +196,7 @@ def test_pyobject_prefix(app):
|
||||
assert doctree[1][1][3].astext().strip() == 'FooBar.say()'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydata(app):
|
||||
text = '.. py:module:: example\n.. py:data:: var\n :type: int\n'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -229,6 +235,7 @@ def test_pydata(app):
|
||||
assert domain.objects['example.var'] == ('index', 'example.var', 'data', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyclass_options(app):
|
||||
text = '.. py:class:: Class1\n.. py:class:: Class2\n :final:\n'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -289,6 +296,7 @@ def test_pyclass_options(app):
|
||||
assert domain.objects['Class2'] == ('index', 'Class2', 'class', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pymethod_options(app):
|
||||
text = (
|
||||
'.. py:class:: Class\n'
|
||||
@@ -475,6 +483,7 @@ def test_pymethod_options(app):
|
||||
assert domain.objects['Class.meth6'] == ('index', 'Class.meth6', 'method', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyclassmethod(app):
|
||||
text = '.. py:class:: Class\n\n .. py:classmethod:: meth\n'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -521,6 +530,7 @@ def test_pyclassmethod(app):
|
||||
assert domain.objects['Class.meth'] == ('index', 'Class.meth', 'method', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pystaticmethod(app):
|
||||
text = '.. py:class:: Class\n\n .. py:staticmethod:: meth\n'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -567,6 +577,7 @@ def test_pystaticmethod(app):
|
||||
assert domain.objects['Class.meth'] == ('index', 'Class.meth', 'method', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyattribute(app):
|
||||
text = (
|
||||
'.. py:class:: Class\n'
|
||||
@@ -640,6 +651,7 @@ def test_pyattribute(app):
|
||||
assert domain.objects['Class.attr'] == ('index', 'Class.attr', 'attribute', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pyproperty(app):
|
||||
text = (
|
||||
'.. py:class:: Class\n'
|
||||
@@ -737,6 +749,7 @@ def test_pyproperty(app):
|
||||
assert domain.objects['Class.prop2'] == ('index', 'Class.prop2', 'property', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_py_type_alias(app):
|
||||
text = (
|
||||
'.. py:module:: example\n'
|
||||
@@ -875,6 +888,7 @@ def test_domain_py_type_alias(app):
|
||||
assert app.warning.getvalue() == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydecorator_signature(app):
|
||||
text = '.. py:decorator:: deco'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -905,6 +919,7 @@ def test_pydecorator_signature(app):
|
||||
assert domain.objects['deco'] == ('index', 'deco', 'function', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pydecoratormethod_signature(app):
|
||||
text = '.. py:decoratormethod:: deco'
|
||||
domain = app.env.get_domain('py')
|
||||
@@ -935,6 +950,7 @@ def test_pydecoratormethod_signature(app):
|
||||
assert domain.objects['deco'] == ('index', 'deco', 'method', False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pycurrentmodule(app):
|
||||
text = (
|
||||
'.. py:module:: Other\n'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the reStructuredText domain."""
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import (
|
||||
desc,
|
||||
@@ -28,6 +30,7 @@ def test_parse_directive():
|
||||
assert s == ('.. :: bar', '')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive(app):
|
||||
# bare
|
||||
text = '.. rst:directive:: toctree'
|
||||
@@ -76,6 +79,7 @@ def test_rst_directive(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive_with_argument(app):
|
||||
text = '.. rst:directive:: .. toctree:: foo bar baz'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -109,6 +113,7 @@ def test_rst_directive_with_argument(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive_option(app):
|
||||
text = '.. rst:directive:option:: foo'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -135,6 +140,7 @@ def test_rst_directive_option(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive_option_with_argument(app):
|
||||
text = '.. rst:directive:option:: foo: bar baz'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -170,6 +176,7 @@ def test_rst_directive_option_with_argument(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive_option_type(app):
|
||||
text = '.. rst:directive:option:: foo\n :type: directives.flags\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -208,6 +215,7 @@ def test_rst_directive_option_type(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_directive_and_directive_option(app):
|
||||
text = '.. rst:directive:: foo\n\n .. rst:directive:option:: bar\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -249,6 +257,7 @@ def test_rst_directive_and_directive_option(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_rst_role(app):
|
||||
text = '.. rst:role:: ref'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
|
||||
@@ -87,6 +87,7 @@ def test_get_full_qualified_name():
|
||||
assert domain.get_full_qualified_name(node) == 'ls.-l'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_cmd_option_with_optional_value(app):
|
||||
text = '.. option:: -j[=N]'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -113,6 +114,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')
|
||||
def test_cmd_option_starting_with_bracket(app):
|
||||
text = '.. option:: [enable=]PATTERN'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -143,6 +145,7 @@ def test_cmd_option_starting_with_bracket(app):
|
||||
) in objects
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary(app):
|
||||
text = (
|
||||
'.. glossary::\n'
|
||||
@@ -238,6 +241,7 @@ def test_glossary(app):
|
||||
assert_node(refnode, nodes.reference, refid='term-TERM2')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_warning(app):
|
||||
# empty line between terms
|
||||
text = '.. glossary::\n\n term1\n\n term2\n'
|
||||
@@ -269,6 +273,7 @@ def test_glossary_warning(app):
|
||||
) in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_comment(app):
|
||||
text = (
|
||||
'.. glossary::\n'
|
||||
@@ -294,6 +299,7 @@ def test_glossary_comment(app):
|
||||
assert_node(doctree[0][0][0][1], [nodes.definition, nodes.paragraph, 'description'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_comment2(app):
|
||||
text = (
|
||||
'.. glossary::\n'
|
||||
@@ -327,6 +333,7 @@ def test_glossary_comment2(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_sorted(app):
|
||||
text = (
|
||||
'.. glossary::\n'
|
||||
@@ -364,6 +371,7 @@ def test_glossary_sorted(app):
|
||||
assert_node(doctree[0][0][1][1], [nodes.definition, nodes.paragraph, 'description'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_alphanumeric(app):
|
||||
text = '.. glossary::\n\n 1\n /\n'
|
||||
restructuredtext.parse(app, text)
|
||||
@@ -372,6 +380,7 @@ def test_glossary_alphanumeric(app):
|
||||
assert ('/', '/', 'term', 'index', 'term-0', -1) in objects
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_glossary_conflicted_labels(app):
|
||||
text = '.. _term-foo:\n.. glossary::\n\n foo\n'
|
||||
restructuredtext.parse(app, text)
|
||||
@@ -379,6 +388,7 @@ def test_glossary_conflicted_labels(app):
|
||||
assert ('foo', 'foo', 'term', 'index', 'term-0', -1) in objects
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_cmdoption(app):
|
||||
text = '.. program:: ls\n\n.. option:: -l\n'
|
||||
domain = app.env.get_domain('std')
|
||||
@@ -405,6 +415,7 @@ def test_cmdoption(app):
|
||||
assert domain.progoptions[('ls', '-l')] == ('index', 'cmdoption-ls-l')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_cmdoption_for_None(app):
|
||||
text = '.. program:: ls\n.. program:: None\n\n.. option:: -l\n'
|
||||
domain = app.env.get_domain('std')
|
||||
@@ -431,6 +442,7 @@ def test_cmdoption_for_None(app):
|
||||
assert domain.progoptions[(None, '-l')] == ('index', 'cmdoption-l')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_multiple_cmdoptions(app):
|
||||
text = '.. program:: cmd\n\n.. option:: -o directory, --output directory\n'
|
||||
domain = app.env.get_domain('std')
|
||||
@@ -471,7 +483,7 @@ def test_multiple_cmdoptions(app):
|
||||
assert domain.progoptions[('cmd', '--output')] == ('index', 'cmdoption-cmd-o')
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='productionlist')
|
||||
@pytest.mark.sphinx('html', testroot='productionlist')
|
||||
def test_productionlist(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -530,6 +542,7 @@ def test_productionlist(app):
|
||||
assert 'A</strong> ::= B C D E F G' in text
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_productionlist2(app):
|
||||
text = '.. productionlist:: P2\n A: `:A` `A`\n B: `P1:B` `~P1:B`\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -544,6 +557,7 @@ def test_productionlist2(app):
|
||||
assert_node(refnodes[3], [pending_xref, nodes.literal, 'B'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_disabled_docref(app):
|
||||
text = ':doc:`index`\n:doc:`!index`\n'
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -558,6 +572,7 @@ def test_disabled_docref(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_labeled_rubric(app):
|
||||
text = '.. _label:\n.. rubric:: blah *blah* blah\n'
|
||||
restructuredtext.parse(app, text)
|
||||
@@ -567,6 +582,7 @@ def test_labeled_rubric(app):
|
||||
assert domain.labels['label'] == ('index', 'label', 'blah blah blah')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_labeled_definition(app):
|
||||
text = (
|
||||
'.. _label1:\n'
|
||||
@@ -589,6 +605,7 @@ def test_labeled_definition(app):
|
||||
assert domain.labels['label2'] == ('index', 'label2', 'Bar blah blah blah')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_labeled_field(app):
|
||||
text = (
|
||||
'.. _label1:\n'
|
||||
|
||||
@@ -52,7 +52,7 @@ def test_config_status(make_app, app_params):
|
||||
assert want_str in app4._status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_images(app):
|
||||
app.build()
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_images(app):
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_object_inventory(app):
|
||||
app.build()
|
||||
refs = app.env.domaindata['py']['objects']
|
||||
|
||||
@@ -8,6 +8,7 @@ from sphinx.testing import restructuredtext
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_single_index(app):
|
||||
@@ -73,6 +74,7 @@ def test_create_single_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_pair_index(app):
|
||||
@@ -139,6 +141,7 @@ def test_create_pair_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_triple_index(app):
|
||||
@@ -170,6 +173,7 @@ def test_create_triple_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_see_index(app):
|
||||
@@ -188,6 +192,7 @@ def test_create_see_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_seealso_index(app):
|
||||
@@ -212,6 +217,7 @@ def test_create_seealso_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_main_index(app):
|
||||
@@ -236,6 +242,7 @@ def test_create_main_index(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_index_with_name(app):
|
||||
@@ -263,6 +270,7 @@ def test_create_index_with_name(app):
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='root',
|
||||
freshenv=True,
|
||||
)
|
||||
def test_create_index_by_key(app):
|
||||
|
||||
@@ -69,6 +69,7 @@ def make_directive_bridge(env):
|
||||
processed_signatures = []
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_parse_name(app):
|
||||
def verify(objtype, name, result):
|
||||
inst = app.registry.documenters[objtype](directive, name)
|
||||
@@ -123,6 +124,7 @@ def test_parse_name(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_format_signature(app):
|
||||
def process_signature(app, what, name, obj, options, args, retann):
|
||||
processed_signatures.append((what, name))
|
||||
@@ -306,6 +308,7 @@ def test_autodoc_process_signature_typing_generic(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_autodoc_process_signature_typehints(app):
|
||||
captured = []
|
||||
|
||||
@@ -328,6 +331,7 @@ def test_autodoc_process_signature_typehints(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_get_doc(app):
|
||||
directive = make_directive_bridge(app.env)
|
||||
|
||||
|
||||
@@ -33,14 +33,11 @@ except ImportError:
|
||||
html_warnfile = StringIO()
|
||||
|
||||
|
||||
default_kw = {
|
||||
'testroot': 'autosummary',
|
||||
'confoverrides': {
|
||||
'extensions': ['sphinx.ext.autosummary'],
|
||||
'autosummary_generate': True,
|
||||
'autosummary_generate_overwrite': False,
|
||||
'source_suffix': '.rst',
|
||||
},
|
||||
defaults = {
|
||||
'extensions': ['sphinx.ext.autosummary'],
|
||||
'autosummary_generate': True,
|
||||
'autosummary_generate_overwrite': False,
|
||||
'source_suffix': '.rst',
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +143,7 @@ def test_extract_summary(capsys):
|
||||
assert err == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', **default_kw)
|
||||
@pytest.mark.sphinx('dummy', testroot='autosummary', confoverrides=defaults.copy())
|
||||
def test_get_items_summary(make_app, app_params):
|
||||
import sphinx.ext.autosummary
|
||||
import sphinx.ext.autosummary.generate
|
||||
@@ -218,7 +215,7 @@ def str_content(elem):
|
||||
return ''.join(str_content(e) for e in elem)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('xml', **default_kw)
|
||||
@pytest.mark.sphinx('xml', testroot='autosummary', confoverrides=defaults.copy())
|
||||
def test_escaping(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -232,7 +229,7 @@ def test_escaping(app):
|
||||
assert str_content(title) == 'underscore_module_'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary')
|
||||
def test_autosummary_generate_content_for_module(app):
|
||||
import autosummary_dummy_module
|
||||
|
||||
@@ -292,7 +289,7 @@ def test_autosummary_generate_content_for_module(app):
|
||||
assert context['objtype'] == 'module'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary')
|
||||
def test_autosummary_generate_content_for_module___all__(app):
|
||||
import autosummary_dummy_module
|
||||
|
||||
@@ -337,7 +334,7 @@ def test_autosummary_generate_content_for_module___all__(app):
|
||||
assert context['objtype'] == 'module'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary')
|
||||
def test_autosummary_generate_content_for_module_skipped(app):
|
||||
import autosummary_dummy_module
|
||||
|
||||
@@ -383,7 +380,7 @@ def test_autosummary_generate_content_for_module_skipped(app):
|
||||
assert context['exceptions'] == []
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary')
|
||||
def test_autosummary_generate_content_for_module_imported_members(app):
|
||||
import autosummary_dummy_module
|
||||
|
||||
@@ -449,7 +446,7 @@ def test_autosummary_generate_content_for_module_imported_members(app):
|
||||
assert context['objtype'] == 'module'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary')
|
||||
def test_autosummary_generate_content_for_module_imported_members_inherited_module(app):
|
||||
import autosummary_dummy_inherited_module
|
||||
|
||||
@@ -752,7 +749,7 @@ def test_autosummary_filename_map(app):
|
||||
assert html_warnings == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', **default_kw)
|
||||
@pytest.mark.sphinx('latex', testroot='autosummary', confoverrides=defaults.copy())
|
||||
def test_autosummary_latex_table_colspec(app):
|
||||
app.build(force_all=True)
|
||||
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
|
||||
@@ -844,6 +841,7 @@ def test_autosummary_module_all(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='ext-autodoc',
|
||||
confoverrides={'extensions': ['sphinx.ext.autosummary']},
|
||||
)
|
||||
@@ -865,7 +863,7 @@ def test_generate_autosummary_docs_property(app):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary-skip-member')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary-skip-member')
|
||||
def test_autosummary_skip_member(app):
|
||||
app.build()
|
||||
|
||||
@@ -874,7 +872,7 @@ def test_autosummary_skip_member(app):
|
||||
assert 'Foo._privatemeth' in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-autosummary-template')
|
||||
@pytest.mark.sphinx('html', testroot='ext-autosummary-template')
|
||||
def test_autosummary_template(app):
|
||||
app.build()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import pickle
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.sphinx('coverage')
|
||||
@pytest.mark.sphinx('coverage', testroot='root')
|
||||
def test_build(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -92,7 +92,9 @@ Classes:
|
||||
assert actual == expected
|
||||
|
||||
|
||||
@pytest.mark.sphinx('coverage', confoverrides={'coverage_show_missing_items': True})
|
||||
@pytest.mark.sphinx(
|
||||
'coverage', testroot='root', confoverrides={'coverage_show_missing_items': True}
|
||||
)
|
||||
def test_show_missing_items(app):
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -105,7 +107,9 @@ def test_show_missing_items(app):
|
||||
assert 'c api Py_SphinxTest [ function]' in app.status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('coverage', confoverrides={'coverage_show_missing_items': True})
|
||||
@pytest.mark.sphinx(
|
||||
'coverage', testroot='root', confoverrides={'coverage_show_missing_items': True}
|
||||
)
|
||||
def test_show_missing_items_quiet(app):
|
||||
app.quiet = True
|
||||
app.build(force_all=True)
|
||||
|
||||
@@ -15,6 +15,7 @@ def test_ifconfig(app):
|
||||
assert 'ham' not in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_ifconfig_content_line_number(app):
|
||||
app.setup_extension('sphinx.ext.ifconfig')
|
||||
text = '.. ifconfig:: confval1\n\n Some link here: :ref:`abc`\n'
|
||||
|
||||
@@ -15,7 +15,7 @@ from sphinx.ext.inheritance_diagram import (
|
||||
from sphinx.ext.intersphinx import load_mappings, validate_intersphinx_mapping
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='html', testroot='inheritance')
|
||||
@pytest.mark.sphinx('html', testroot='inheritance')
|
||||
@pytest.mark.usefixtures('if_graphviz_found')
|
||||
def test_inheritance_diagram(app):
|
||||
# monkey-patch InheritaceDiagram.run() so we can get access to its
|
||||
|
||||
@@ -70,6 +70,7 @@ def set_config(app, mapping):
|
||||
|
||||
@mock.patch('sphinx.ext.intersphinx._load.InventoryFile')
|
||||
@mock.patch('sphinx.ext.intersphinx._load._read_from_url')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_fetch_inventory_redirection(_read_from_url, InventoryFile, app): # NoQA: PT019
|
||||
intersphinx_setup(app)
|
||||
_read_from_url().readline.return_value = b'# Sphinx inventory version 2'
|
||||
@@ -136,6 +137,7 @@ def test_fetch_inventory_redirection(_read_from_url, InventoryFile, app): # NoQ
|
||||
assert InventoryFile.load.call_args[0][1] == 'https://hostname/'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_missing_reference(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -227,6 +229,7 @@ def test_missing_reference(tmp_path, app):
|
||||
assert rn['refuri'] == 'https://docs.python.org/docname.html'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_missing_reference_pydomain(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -260,6 +263,7 @@ def test_missing_reference_pydomain(tmp_path, app):
|
||||
assert rn.astext() == 'Foo.bar'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_missing_reference_stddomain(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -320,6 +324,7 @@ def test_missing_reference_stddomain(tmp_path, app):
|
||||
('B TERM', True),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_ambiguous_reference_handling(term, expected_ambiguity, tmp_path, app, warning):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2_AMBIGUOUS_TERMS)
|
||||
@@ -378,6 +383,7 @@ def test_missing_reference_cppdomain(tmp_path, app):
|
||||
) in html
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_missing_reference_jsdomain(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -405,6 +411,7 @@ def test_missing_reference_jsdomain(tmp_path, app):
|
||||
assert rn.astext() == 'baz()'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_missing_reference_disabled_domain(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -470,6 +477,7 @@ def test_missing_reference_disabled_domain(tmp_path, app):
|
||||
case(term=False, doc=False, py=False)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_inventory_not_having_version(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2_NO_VERSION)
|
||||
@@ -491,6 +499,7 @@ def test_inventory_not_having_version(tmp_path, app):
|
||||
assert rn[0].astext() == 'Long Module desc'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_validate_intersphinx_mapping_warnings(app):
|
||||
"""Check warnings in :func:`sphinx.ext.intersphinx.validate_intersphinx_mapping`."""
|
||||
bad_intersphinx_mapping = {
|
||||
@@ -544,6 +553,7 @@ def test_validate_intersphinx_mapping_warnings(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_load_mappings_fallback(tmp_path, app):
|
||||
inv_file = tmp_path / 'inventory'
|
||||
inv_file.write_bytes(INVENTORY_V2)
|
||||
@@ -733,6 +743,7 @@ if TYPE_CHECKING:
|
||||
from sphinx.ext.intersphinx._shared import InventoryCacheEntry
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_intersphinx_cache_limit(app):
|
||||
url = 'https://example.org/'
|
||||
app.config.intersphinx_cache_limit = -1
|
||||
|
||||
@@ -2736,6 +2736,7 @@ definition_after_normal_text : int
|
||||
actual = NumpyDocstring(docstring, config)
|
||||
assert str(actual) == expected
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_token_type_invalid(self, app):
|
||||
tokens = (
|
||||
'{1, 2',
|
||||
|
||||
@@ -50,6 +50,7 @@ def check_viewcode_output(app: SphinxTestApp) -> str:
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='ext-viewcode',
|
||||
freshenv=True,
|
||||
confoverrides={'viewcode_line_numbers': True},
|
||||
@@ -64,6 +65,7 @@ def test_viewcode_linenos(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='ext-viewcode',
|
||||
freshenv=True,
|
||||
confoverrides={'viewcode_line_numbers': False},
|
||||
@@ -104,7 +106,7 @@ def test_viewcode_epub_enabled(app):
|
||||
assert result.count('href="_modules/spam/mod1.xhtml#func1"') == 2
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
||||
@pytest.mark.sphinx('html', testroot='ext-viewcode', tags=['test_linkcode'])
|
||||
def test_linkcode(app):
|
||||
app.build(filenames=[app.srcdir / 'objects.rst'])
|
||||
|
||||
@@ -116,7 +118,7 @@ def test_linkcode(app):
|
||||
assert 'https://foobar/cpp/' in stuff
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode-find', freshenv=True)
|
||||
@pytest.mark.sphinx('html', testroot='ext-viewcode-find', freshenv=True)
|
||||
def test_local_source_files(app):
|
||||
def find_source(app, modname):
|
||||
if modname == 'not_a_package':
|
||||
|
||||
@@ -6,6 +6,7 @@ from sphinx.errors import VersionRequirementError
|
||||
from sphinx.extension import Extension, verify_needs_extensions
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_needs_extensions(app):
|
||||
# empty needs_extensions
|
||||
assert app.config.needs_extensions == {}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from unittest import mock
|
||||
|
||||
import pygments
|
||||
import pytest
|
||||
from pygments.formatters.html import HtmlFormatter
|
||||
from pygments.lexer import RegexLexer
|
||||
from pygments.token import Name, Text
|
||||
@@ -37,6 +38,7 @@ class ComplainOnUnhighlighted(PygmentsBridge):
|
||||
raise AssertionError('should highlight %r' % source)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_add_lexer(app):
|
||||
app.add_lexer('test', MyLexer)
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ from sphinx.util.nodes import NodeMatcher
|
||||
_CATALOG_LOCALE = 'xx'
|
||||
|
||||
sphinx_intl = pytest.mark.sphinx(
|
||||
testroot='intl',
|
||||
confoverrides={
|
||||
'language': _CATALOG_LOCALE,
|
||||
'locale_dirs': ['.'],
|
||||
@@ -91,7 +90,7 @@ def assert_count(expected_expr, result, count):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_emit_warnings(app):
|
||||
app.build()
|
||||
@@ -107,7 +106,7 @@ def test_text_emit_warnings(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_warning_node(app):
|
||||
app.build()
|
||||
@@ -122,7 +121,7 @@ def test_text_warning_node(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_title_underline(app):
|
||||
app.build()
|
||||
@@ -137,7 +136,7 @@ def test_text_title_underline(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_subdirs(app):
|
||||
app.build()
|
||||
@@ -147,7 +146,7 @@ def test_text_subdirs(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_inconsistency_warnings(app):
|
||||
app.build()
|
||||
@@ -215,7 +214,7 @@ def test_text_inconsistency_warnings(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_noqa(app):
|
||||
app.build()
|
||||
@@ -241,7 +240,7 @@ TO TEST BARE noqa.
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_literalblock_warnings(app):
|
||||
app.build()
|
||||
@@ -268,7 +267,7 @@ def test_text_literalblock_warnings(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_definition_terms(app):
|
||||
app.build()
|
||||
@@ -290,7 +289,7 @@ def test_text_definition_terms(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_glossary_term(app):
|
||||
app.build()
|
||||
@@ -325,7 +324,7 @@ VVV
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_glossary_term_inconsistencies(app):
|
||||
app.build()
|
||||
@@ -361,7 +360,7 @@ def test_text_glossary_term_inconsistencies(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_section(app):
|
||||
app.build()
|
||||
@@ -373,7 +372,7 @@ def test_gettext_section(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_section(app):
|
||||
app.build()
|
||||
@@ -385,7 +384,7 @@ def test_text_section(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_seealso(app):
|
||||
app.build()
|
||||
@@ -404,7 +403,7 @@ def test_text_seealso(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_figure_captions(app):
|
||||
app.build()
|
||||
@@ -450,7 +449,7 @@ def test_text_figure_captions(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_rubric(app):
|
||||
app.build()
|
||||
@@ -470,7 +469,7 @@ def test_text_rubric(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_docfields(app):
|
||||
app.build()
|
||||
@@ -501,7 +500,7 @@ def test_text_docfields(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_admonitions(app):
|
||||
app.build()
|
||||
@@ -530,7 +529,7 @@ def test_text_admonitions(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_toctree(app):
|
||||
app.build()
|
||||
@@ -547,7 +546,7 @@ def test_gettext_toctree(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_table(app):
|
||||
app.build()
|
||||
@@ -559,7 +558,7 @@ def test_gettext_table(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_table(app):
|
||||
app.build()
|
||||
@@ -571,7 +570,7 @@ def test_text_table(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_toctree(app):
|
||||
app.build()
|
||||
@@ -588,7 +587,7 @@ def test_text_toctree(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_topic(app):
|
||||
app.build()
|
||||
@@ -600,7 +599,7 @@ def test_gettext_topic(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_topic(app):
|
||||
app.build()
|
||||
@@ -612,7 +611,7 @@ def test_text_topic(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_definition_terms(app):
|
||||
app.build()
|
||||
@@ -626,7 +625,7 @@ def test_gettext_definition_terms(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_glossary_terms(app):
|
||||
app.build()
|
||||
@@ -640,7 +639,7 @@ def test_gettext_glossary_terms(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_glossary_term_inconsistencies(app):
|
||||
app.build()
|
||||
@@ -654,7 +653,7 @@ def test_gettext_glossary_term_inconsistencies(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_literalblock(app):
|
||||
app.build()
|
||||
@@ -670,7 +669,7 @@ def test_gettext_literalblock(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('gettext')
|
||||
@pytest.mark.sphinx('gettext', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_gettext')
|
||||
def test_gettext_buildr_ignores_only_directive(app):
|
||||
app.build()
|
||||
@@ -682,6 +681,7 @@ def test_gettext_buildr_ignores_only_directive(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
def test_node_translated_attribute(app):
|
||||
app.build(filenames=[app.srcdir / 'translation_progress.txt'])
|
||||
|
||||
@@ -695,6 +695,7 @@ def test_node_translated_attribute(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
def test_translation_progress_substitution(app):
|
||||
app.build(filenames=[app.srcdir / 'translation_progress.txt'])
|
||||
|
||||
@@ -704,6 +705,7 @@ def test_translation_progress_substitution(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='intl',
|
||||
freshenv=True,
|
||||
confoverrides={
|
||||
@@ -837,8 +839,8 @@ def mock_time_and_i18n(
|
||||
yield mock, clock
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
# use the same testroot as 'gettext' since the latter contains less PO files
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx(
|
||||
'dummy',
|
||||
testroot='builder-gettext-dont-rebuild-mo',
|
||||
@@ -950,7 +952,7 @@ def test_gettext_dont_rebuild_mo(mock_time_and_i18n, app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_meta(app):
|
||||
app.build()
|
||||
@@ -969,7 +971,7 @@ def test_html_meta(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_footnotes(app):
|
||||
app.build()
|
||||
@@ -979,7 +981,7 @@ def test_html_footnotes(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_undefined_refs(app):
|
||||
app.build()
|
||||
@@ -1003,7 +1005,7 @@ def test_html_undefined_refs(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_index_entries(app):
|
||||
app.build()
|
||||
@@ -1047,7 +1049,7 @@ def test_html_index_entries(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_versionchanges(app):
|
||||
app.build()
|
||||
@@ -1092,7 +1094,7 @@ def test_html_versionchanges(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_docfields(app):
|
||||
app.build()
|
||||
@@ -1102,7 +1104,7 @@ def test_html_docfields(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_template(app):
|
||||
app.build()
|
||||
@@ -1113,7 +1115,7 @@ def test_html_template(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_html_rebuild_mo(app):
|
||||
app.build()
|
||||
@@ -1132,7 +1134,7 @@ def test_html_rebuild_mo(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_footnotes(app):
|
||||
app.build()
|
||||
@@ -1181,7 +1183,7 @@ def test_xml_footnotes(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_footnote_backlinks(app):
|
||||
app.build()
|
||||
@@ -1201,7 +1203,7 @@ def test_xml_footnote_backlinks(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_refs_in_python_domain(app):
|
||||
app.build()
|
||||
@@ -1219,7 +1221,7 @@ def test_xml_refs_in_python_domain(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_keep_external_links(app):
|
||||
app.build()
|
||||
@@ -1287,7 +1289,7 @@ def test_xml_keep_external_links(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_role_xref(app):
|
||||
app.build()
|
||||
@@ -1362,7 +1364,7 @@ def test_xml_role_xref(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_warnings(app):
|
||||
app.build()
|
||||
@@ -1374,7 +1376,7 @@ def test_xml_warnings(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_label_targets(app):
|
||||
app.build()
|
||||
@@ -1456,7 +1458,7 @@ def test_xml_label_targets(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('xml')
|
||||
@pytest.mark.sphinx('xml', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_xml_strange_markup(app):
|
||||
app.build()
|
||||
@@ -1469,7 +1471,7 @@ def test_xml_strange_markup(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_additional_targets_should_not_be_translated(app):
|
||||
app.build()
|
||||
@@ -1539,6 +1541,7 @@ def test_additional_targets_should_not_be_translated(app):
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='intl',
|
||||
srcdir='test_additional_targets_should_be_translated',
|
||||
confoverrides={
|
||||
'language': _CATALOG_LOCALE,
|
||||
@@ -1665,7 +1668,7 @@ def test_additional_targets_should_be_translated_substitution_definitions(app):
|
||||
|
||||
|
||||
@sphinx_intl
|
||||
@pytest.mark.sphinx('text')
|
||||
@pytest.mark.sphinx('text', testroot='intl')
|
||||
@pytest.mark.test_params(shared_result='test_intl_basic')
|
||||
def test_text_references(app):
|
||||
app.build(filenames=[app.srcdir / 'refs.txt'])
|
||||
|
||||
@@ -56,6 +56,7 @@ def test_init_with_unknown_language(rootdir):
|
||||
assert _('Hello reST') == 'Hello reST'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_add_message_catalog(app, rootdir):
|
||||
app.config.language = 'en'
|
||||
app.add_message_catalog('myext', rootdir / 'test-locale' / 'locale1')
|
||||
|
||||
@@ -448,6 +448,7 @@ def get_verifier(verify, verify_re):
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_inline(get_verifier, type, rst, html_expected, latex_expected):
|
||||
verifier = get_verifier(type)
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
@@ -464,12 +465,13 @@ def test_inline(get_verifier, type, rst, html_expected, latex_expected):
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_inline_docutils16(get_verifier, type, rst, html_expected, latex_expected):
|
||||
verifier = get_verifier(type)
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'latex_engine': 'xelatex'})
|
||||
@pytest.mark.sphinx('html', testroot='root', confoverrides={'latex_engine': 'xelatex'})
|
||||
@pytest.mark.parametrize(
|
||||
('type', 'rst', 'html_expected', 'latex_expected'),
|
||||
[
|
||||
@@ -493,6 +495,7 @@ def test_inline_for_unicode_latex_engine(
|
||||
verifier(rst, html_expected, latex_expected)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_samp_role(parse):
|
||||
# no braces
|
||||
text = ':samp:`a{b}c`'
|
||||
@@ -524,6 +527,7 @@ def test_samp_role(parse):
|
||||
assert_node(doctree[0], [nodes.paragraph, nodes.literal, 'code sample'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_download_role(parse):
|
||||
# implicit
|
||||
text = ':download:`sphinx.rst`'
|
||||
@@ -562,6 +566,7 @@ def test_download_role(parse):
|
||||
assert_node(doctree[0][0][0], classes=['xref', 'download'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_XRefRole(inliner):
|
||||
role = XRefRole()
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from sphinx.parsers import RSTParser
|
||||
from sphinx.util.docutils import new_document
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='basic')
|
||||
@pytest.mark.sphinx('html', testroot='basic')
|
||||
@patch('docutils.parsers.rst.states.RSTStateMachine')
|
||||
def test_RSTParser_prolog_epilog(RSTStateMachine, app):
|
||||
document = new_document('dummy.rst')
|
||||
|
||||
@@ -75,8 +75,9 @@ def test_project_path2doc(rootdir):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
srcdir='project_doc2path',
|
||||
'html',
|
||||
testroot='basic',
|
||||
srcdir='project_doc2path',
|
||||
)
|
||||
def test_project_doc2path(app):
|
||||
source_suffix = {'.rst': 'restructuredtext', '.txt': 'restructuredtext'}
|
||||
|
||||
@@ -6,8 +6,8 @@ from os import path
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx import application
|
||||
from sphinx.cmd import quickstart as qs
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
from sphinx.util.console import coloron, nocolor
|
||||
|
||||
warnfile = StringIO()
|
||||
@@ -208,16 +208,9 @@ def test_quickstart_and_build(tmp_path):
|
||||
qs.ask_user(d)
|
||||
qs.generate(d)
|
||||
|
||||
app = application.Sphinx(
|
||||
tmp_path, # srcdir
|
||||
tmp_path, # confdir
|
||||
(tmp_path / '_build' / 'html'), # outdir
|
||||
(tmp_path / '_build' / '.doctree'), # doctreedir
|
||||
'html', # buildername
|
||||
status=StringIO(),
|
||||
warning=warnfile,
|
||||
)
|
||||
app = SphinxTestApp('html', srcdir=tmp_path, warning=warnfile)
|
||||
app.build(force_all=True)
|
||||
app.cleanup()
|
||||
warnings = warnfile.getvalue()
|
||||
assert not warnings
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ test that non-comments are indexed: fermion
|
||||
"""
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode')
|
||||
@pytest.mark.sphinx('html', testroot='ext-viewcode')
|
||||
def test_objects_are_escaped(app):
|
||||
app.build(force_all=True)
|
||||
index = load_searchindex(app.outdir / 'searchindex.js')
|
||||
@@ -94,7 +94,7 @@ def test_objects_are_escaped(app):
|
||||
raise AssertionError(index.get('objects').get(''))
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_meta_keys_are_handled_for_language_en(app):
|
||||
app.build(force_all=True)
|
||||
searchindex = load_searchindex(app.outdir / 'searchindex.js')
|
||||
@@ -108,6 +108,7 @@ def test_meta_keys_are_handled_for_language_en(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='search',
|
||||
confoverrides={'html_search_language': 'de'},
|
||||
freshenv=True,
|
||||
@@ -124,14 +125,14 @@ def test_meta_keys_are_handled_for_language_de(app):
|
||||
assert is_registered_term(searchindex, 'onlytoogerman')
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_stemmer_does_not_remove_short_words(app):
|
||||
app.build(force_all=True)
|
||||
searchindex = (app.outdir / 'searchindex.js').read_text(encoding='utf8')
|
||||
assert 'bat' in searchindex
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_stemmer(app):
|
||||
app.build(force_all=True)
|
||||
searchindex = load_searchindex(app.outdir / 'searchindex.js')
|
||||
@@ -140,7 +141,7 @@ def test_stemmer(app):
|
||||
assert is_registered_term(searchindex, 'intern')
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_term_in_heading_and_section(app):
|
||||
app.build(force_all=True)
|
||||
searchindex = (app.outdir / 'searchindex.js').read_text(encoding='utf8')
|
||||
@@ -151,7 +152,7 @@ def test_term_in_heading_and_section(app):
|
||||
assert '"textinhead": 0' in searchindex
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_term_in_raw_directive(app):
|
||||
app.build(force_all=True)
|
||||
searchindex = load_searchindex(app.outdir / 'searchindex.js')
|
||||
@@ -354,6 +355,7 @@ def test_IndexBuilder_lookup():
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='search',
|
||||
confoverrides={'html_search_language': 'zh'},
|
||||
srcdir='search_zh',
|
||||
@@ -368,6 +370,7 @@ def test_search_index_gen_zh(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='search',
|
||||
freshenv=True,
|
||||
)
|
||||
@@ -383,6 +386,7 @@ def test_nosearch(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='search',
|
||||
parallel=3,
|
||||
freshenv=True,
|
||||
@@ -393,7 +397,7 @@ def test_parallel(app):
|
||||
assert index['docnames'] == ['index', 'nosearch', 'tocitem']
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='search')
|
||||
@pytest.mark.sphinx('html', testroot='search')
|
||||
def test_search_index_is_deterministic(app):
|
||||
app.build(force_all=True)
|
||||
index = load_searchindex(app.outdir / 'searchindex.js')
|
||||
|
||||
@@ -23,6 +23,7 @@ HERE = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='theming',
|
||||
confoverrides={'html_theme': 'ziptheme', 'html_theme_options.testopt': 'foo'},
|
||||
)
|
||||
@@ -97,13 +98,14 @@ def test_nonexistent_theme_settings(tmp_path):
|
||||
_load_theme('', str(tmp_path))
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='double-inheriting-theme')
|
||||
@pytest.mark.sphinx('html', testroot='double-inheriting-theme')
|
||||
def test_double_inheriting_theme(app):
|
||||
assert app.builder.theme.name == 'base_theme2'
|
||||
app.build() # => not raises TemplateNotFound
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='theming',
|
||||
confoverrides={'html_theme': 'child'},
|
||||
)
|
||||
@@ -113,6 +115,7 @@ def test_nested_zipped_theme(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='theming',
|
||||
confoverrides={'html_theme': 'staticfiles'},
|
||||
)
|
||||
@@ -134,6 +137,7 @@ def test_staticfiles(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html',
|
||||
testroot='theming',
|
||||
confoverrides={'html_theme': 'test-theme'},
|
||||
)
|
||||
@@ -168,7 +172,7 @@ def test_dark_style(app, monkeypatch):
|
||||
) in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='theming')
|
||||
@pytest.mark.sphinx('html', testroot='theming')
|
||||
def test_theme_sidebars(app):
|
||||
app.build()
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class TestSigElementFallbackTransform:
|
||||
'without_default_visitors_for_desc_sig_elements',
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_support_desc_inline(
|
||||
self,
|
||||
document: nodes.document,
|
||||
@@ -235,7 +235,7 @@ class TestSigElementFallbackTransform:
|
||||
'without_default_visitors_for_desc_sig_elements',
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_custom_implementation(
|
||||
self,
|
||||
document: nodes.document,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Tests the transformations"""
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
@@ -7,6 +8,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_transforms_reorder_consecutive_target_and_index_nodes_preserve_order(app):
|
||||
text = (
|
||||
'.. index:: abc\n'
|
||||
@@ -50,6 +52,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')
|
||||
def test_transforms_reorder_consecutive_target_and_index_nodes_no_merge_across_other_nodes(
|
||||
app,
|
||||
):
|
||||
@@ -100,6 +103,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')
|
||||
def test_transforms_reorder_consecutive_target_and_index_nodes_merge_with_labels(app):
|
||||
text = (
|
||||
'.. _abc:\n'
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_display_chunk():
|
||||
assert display_chunk(('hello', 'sphinx', 'world')) == 'hello .. world'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_status_iterator_length_0(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
|
||||
@@ -33,7 +33,7 @@ def test_status_iterator_length_0(app):
|
||||
assert yields == ['hello', 'sphinx', 'world']
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_status_iterator_verbosity_0(app, monkeypatch):
|
||||
monkeypatch.setenv('FORCE_COLOR', '1')
|
||||
logging.setup(app, app.status, app.warning)
|
||||
@@ -51,7 +51,7 @@ def test_status_iterator_verbosity_0(app, monkeypatch):
|
||||
assert 'testing ... [100%] world\r\n' in output
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy')
|
||||
@pytest.mark.sphinx('dummy', testroot='root')
|
||||
def test_status_iterator_verbosity_1(app, monkeypatch):
|
||||
monkeypatch.setenv('FORCE_COLOR', '1')
|
||||
logging.setup(app, app.status, app.warning)
|
||||
@@ -69,6 +69,7 @@ def test_status_iterator_verbosity_1(app, monkeypatch):
|
||||
assert 'testing ... [100%] world\n\n' in output
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_progress_message(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import os
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx.util.docutils import (
|
||||
@@ -67,6 +68,7 @@ def test_SphinxFileOutput(tmpdir):
|
||||
assert os.stat(filename).st_mtime_ns != 0 # updated
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_SphinxTranslator(app):
|
||||
class CustomNode(nodes.inline):
|
||||
pass
|
||||
|
||||
@@ -93,6 +93,7 @@ def test_format_date():
|
||||
assert i18n.format_date(format, date=datet, language='en') == '+0000'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_get_filename_for_language(app):
|
||||
get_filename = i18n.get_image_filename_for_language
|
||||
app.env.temp_data['docname'] = 'index'
|
||||
|
||||
@@ -7,6 +7,8 @@ import posixpath
|
||||
from io import BytesIO
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
import sphinx.locale
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
from sphinx.util.inventory import InventoryFile
|
||||
@@ -77,6 +79,7 @@ def test_read_inventory_v2_not_having_version():
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_ambiguous_definition_warning(app):
|
||||
f = BytesIO(INVENTORY_V2_AMBIGUOUS_TERMS)
|
||||
InventoryFile.load(f, '/util', posixpath.join)
|
||||
|
||||
@@ -14,6 +14,7 @@ from sphinx.util.logging import is_suppressed_warning, prefixed_warnings
|
||||
from sphinx.util.parallel import ParallelTasks
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_and_warning(app):
|
||||
app.verbosity = 2
|
||||
logging.setup(app, app.status, app.warning)
|
||||
@@ -38,6 +39,7 @@ def test_info_and_warning(app):
|
||||
assert 'ERROR: message5' in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_Exception(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -46,6 +48,7 @@ def test_Exception(app):
|
||||
assert "<class 'Exception'>" in app.status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_verbosity_filter(app):
|
||||
# verbosity = 0: INFO
|
||||
app.verbosity = 0
|
||||
@@ -90,6 +93,7 @@ def test_verbosity_filter(app):
|
||||
assert 'message4' not in app.status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_nonl_info_log(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -101,6 +105,7 @@ def test_nonl_info_log(app):
|
||||
assert 'message1message2\nmessage3' in app.status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_once_warning_log(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -127,6 +132,7 @@ def test_is_suppressed_warning():
|
||||
assert is_suppressed_warning('rest', 'duplicated_labels', suppress_warnings) is True
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_suppress_warnings(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -170,6 +176,7 @@ def test_suppress_warnings(app):
|
||||
assert app._warncount == 8
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_warningiserror(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -188,6 +195,7 @@ def test_warningiserror(app):
|
||||
logger.warning('%s')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_info_location(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -219,6 +227,7 @@ def test_info_location(app):
|
||||
assert '\nmessage7' in app.status.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_warning_location(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -250,6 +259,7 @@ def test_warning_location(app):
|
||||
assert colorize('red', 'WARNING: message7') in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_suppress_logging(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -264,6 +274,7 @@ def test_suppress_logging(app):
|
||||
assert 'WARNING: message2' not in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_pending_warnings(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -282,6 +293,7 @@ def test_pending_warnings(app):
|
||||
assert 'WARNING: message2\nWARNING: message3' in warnings
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_colored_logs(app):
|
||||
app.verbosity = 2
|
||||
logging.setup(app, app.status, app.warning)
|
||||
@@ -328,6 +340,7 @@ def test_logging_in_ParallelTasks(app):
|
||||
assert 'index.txt: WARNING: message2' in app.warning.getvalue()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_output_with_unencodable_char(app):
|
||||
class StreamWriter(codecs.StreamWriter):
|
||||
def write(self, object):
|
||||
@@ -343,6 +356,7 @@ def test_output_with_unencodable_char(app):
|
||||
assert app.status.getvalue() == 'unicode ?...\n'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_skip_warningiserror(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -367,6 +381,7 @@ def test_skip_warningiserror(app):
|
||||
logger.warning('message')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prefixed_warnings(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -401,7 +416,7 @@ def test_get_node_location_abspath():
|
||||
assert location == absolute_filename + ':'
|
||||
|
||||
|
||||
@pytest.mark.sphinx(confoverrides={'show_warning_types': True})
|
||||
@pytest.mark.sphinx('html', testroot='root', confoverrides={'show_warning_types': True})
|
||||
def test_show_warning_types(app):
|
||||
logging.setup(app, app.status, app.warning)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -214,17 +214,20 @@ def test_clean_astext():
|
||||
('', 'sphinx-', 'sphinx'), # ends with hyphen
|
||||
],
|
||||
)
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_make_id(app, prefix, term, expected):
|
||||
document = create_new_document()
|
||||
assert make_id(app.env, document, prefix, term) == expected
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_make_id_already_registered(app):
|
||||
document = create_new_document()
|
||||
document.ids['term-Sphinx'] = True # register "term-Sphinx" manually
|
||||
assert make_id(app.env, document, 'term', 'Sphinx') == 'term-0'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_make_id_sequential(app):
|
||||
document = create_new_document()
|
||||
document.ids['term-0'] = True
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Tests sphinx.util.rst functions."""
|
||||
|
||||
import pytest
|
||||
from docutils.statemachine import StringList
|
||||
from jinja2 import Environment
|
||||
|
||||
@@ -13,6 +14,7 @@ def test_escape():
|
||||
assert escape('.. toctree::') == r'\.. toctree\:\:'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_append_epilog(app):
|
||||
epilog = 'this is rst_epilog\ngood-bye reST!'
|
||||
content = StringList(
|
||||
@@ -30,6 +32,7 @@ def test_append_epilog(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog(app):
|
||||
prolog = 'this is rst_prolog\nhello reST!'
|
||||
content = StringList(
|
||||
@@ -57,6 +60,7 @@ def test_prepend_prolog(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog_with_CR(app):
|
||||
# prolog having CR at tail
|
||||
prolog = 'this is rst_prolog\nhello reST!\n'
|
||||
@@ -75,6 +79,7 @@ def test_prepend_prolog_with_CR(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog_without_CR(app):
|
||||
# prolog not having CR at tail
|
||||
prolog = 'this is rst_prolog\nhello reST!'
|
||||
@@ -93,6 +98,7 @@ def test_prepend_prolog_without_CR(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog_with_roles_in_sections(app):
|
||||
prolog = 'this is rst_prolog\nhello reST!'
|
||||
content = StringList(
|
||||
@@ -124,6 +130,7 @@ def test_prepend_prolog_with_roles_in_sections(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog_with_roles_in_sections_with_newline(app):
|
||||
# prologue with trailing line break
|
||||
prolog = 'this is rst_prolog\nhello reST!\n'
|
||||
@@ -141,6 +148,7 @@ def test_prepend_prolog_with_roles_in_sections_with_newline(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_prepend_prolog_with_roles_in_sections_without_newline(app):
|
||||
# prologue with no trailing line break
|
||||
prolog = 'this is rst_prolog\nhello reST!'
|
||||
|
||||
@@ -13,7 +13,7 @@ def _setup_module(rootdir):
|
||||
sys.path[:] = saved_path
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html')
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_html_translator(app):
|
||||
# no set_translator()
|
||||
translator_class = app.builder.get_translator_class()
|
||||
|
||||
Reference in New Issue
Block a user