mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Prefer `@pytest.fixture()
`
This commit is contained in:
parent
c8f4a03dac
commit
f6435a9bc3
@ -55,7 +55,7 @@ class SharedResult:
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def app_params(request: Any, test_params: dict, shared_result: SharedResult,
|
||||
sphinx_test_tempdir: str, rootdir: str) -> tuple[dict, dict]:
|
||||
"""
|
||||
@ -98,7 +98,7 @@ def app_params(request: Any, test_params: dict, shared_result: SharedResult,
|
||||
return namedtuple('app_params', 'args,kwargs')(args, kwargs) # type: ignore
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def test_params(request: Any) -> dict:
|
||||
"""
|
||||
Test parameters that are specified by 'pytest.mark.test_params'
|
||||
@ -187,7 +187,7 @@ def make_app(test_params: dict, monkeypatch: Any) -> Generator[Callable, None, N
|
||||
app_.cleanup()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def shared_result() -> SharedResult:
|
||||
return SharedResult()
|
||||
|
||||
@ -197,7 +197,7 @@ def _shared_result_cache() -> None:
|
||||
SharedResult.cache.clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def if_graphviz_found(app: SphinxTestApp) -> None:
|
||||
"""
|
||||
The test will be skipped when using 'if_graphviz_found' fixture and graphviz
|
||||
@ -223,7 +223,7 @@ def sphinx_test_tempdir(tmpdir_factory: Any) -> util.path:
|
||||
return util.path(tmpdir).abspath()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def tempdir(tmpdir: str) -> util.path:
|
||||
"""
|
||||
Temporary directory wrapped with `path` class.
|
||||
@ -232,7 +232,7 @@ def tempdir(tmpdir: str) -> util.path:
|
||||
return util.path(tmpdir)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def rollback_sysmodules():
|
||||
"""
|
||||
Rollback sys.modules to its value before testing to unload modules
|
||||
|
@ -16,7 +16,7 @@ def request_session_head(url, **kwargs):
|
||||
return response
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
|
||||
# Build in a non-ASCII source dir
|
||||
test_name = '\u65e5\u672c\u8a9e'
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from sphinx.testing.util import find_files
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def setup_test(app_params):
|
||||
srcdir = app_params.kwargs['srcdir']
|
||||
src_locale_dir = srcdir / 'xx' / 'LC_MESSAGES'
|
||||
|
@ -153,7 +153,7 @@ def test_errors_if_setup_is_not_callable(tempdir, make_app):
|
||||
assert 'callable' in str(excinfo.value)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def make_app_with_empty_project(make_app, tempdir):
|
||||
(tempdir / 'conf.py').write_text('', encoding='utf8')
|
||||
|
||||
|
@ -20,7 +20,7 @@ def apidoc(rootdir, tempdir, apidoc_params):
|
||||
return namedtuple('apidoc', 'coderoot,outdir')(coderoot, outdir)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def apidoc_params(request):
|
||||
pargs = {}
|
||||
kwargs = {}
|
||||
|
@ -5,7 +5,7 @@ import subprocess
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def if_converter_found(app):
|
||||
image_converter = getattr(app.config, 'image_converter', '')
|
||||
try:
|
||||
|
@ -20,7 +20,7 @@ from sphinx.writers.html import HTML5Translator, HTMLWriter
|
||||
from sphinx.writers.latex import LaTeXTranslator, LaTeXWriter
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def settings(app):
|
||||
texescape.init() # otherwise done by the latex builder
|
||||
with warnings.catch_warnings():
|
||||
@ -41,7 +41,7 @@ def settings(app):
|
||||
domain_context.disable()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def new_document(settings):
|
||||
def create():
|
||||
document = utils.new_document('test data', settings)
|
||||
@ -51,14 +51,14 @@ def new_document(settings):
|
||||
return create
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def inliner(new_document):
|
||||
document = new_document()
|
||||
document.reporter.get_source_and_line = lambda line=1: ('dummy.rst', line)
|
||||
return Struct(document=document, reporter=document.reporter)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def parse(new_document):
|
||||
def parse_(rst):
|
||||
document = new_document()
|
||||
@ -89,7 +89,7 @@ class ForgivingLaTeXTranslator(LaTeXTranslator, ForgivingTranslator):
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def verify_re_html(app, parse):
|
||||
def verify(rst, html_expected):
|
||||
document = parse(rst)
|
||||
@ -101,7 +101,7 @@ def verify_re_html(app, parse):
|
||||
return verify
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def verify_re_latex(app, parse):
|
||||
def verify(rst, latex_expected):
|
||||
document = parse(rst)
|
||||
@ -116,7 +116,7 @@ def verify_re_latex(app, parse):
|
||||
return verify
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def verify_re(verify_re_html, verify_re_latex):
|
||||
def verify_re_(rst, html_expected, latex_expected):
|
||||
if html_expected:
|
||||
@ -126,7 +126,7 @@ def verify_re(verify_re_html, verify_re_latex):
|
||||
return verify_re_
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def verify(verify_re_html, verify_re_latex):
|
||||
def verify_(rst, html_expected, latex_expected):
|
||||
if html_expected:
|
||||
@ -136,7 +136,7 @@ def verify(verify_re_html, verify_re_latex):
|
||||
return verify_
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def get_verifier(verify, verify_re):
|
||||
v = {
|
||||
'verify': verify,
|
||||
|
@ -12,7 +12,7 @@ import sphinx
|
||||
from sphinx.util.osutil import cd
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def setup_command(request, tempdir, rootdir):
|
||||
"""
|
||||
Run `setup.py build_sphinx` with args and kwargs,
|
||||
@ -65,7 +65,7 @@ def test_build_sphinx_multiple_invalid_builders(setup_command):
|
||||
assert proc.returncode == 1
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def nonascii_srcdir(request, setup_command):
|
||||
mb_name = '\u65e5\u672c\u8a9e'
|
||||
srcdir = (setup_command.pkgroot / 'doc')
|
||||
|
Loading…
Reference in New Issue
Block a user