mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
pytest: remove deprecated with_app decorator functions
This commit is contained in:
@@ -15,11 +15,10 @@ from docutils import nodes
|
||||
from sphinx.application import ExtensionError
|
||||
from sphinx.domains import Domain
|
||||
|
||||
from util import with_app, strip_escseq
|
||||
from util import strip_escseq
|
||||
import pytest
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_events(app, status, warning):
|
||||
def empty():
|
||||
pass
|
||||
@@ -45,13 +44,11 @@ def test_events(app, status, warning):
|
||||
"Callback called when disconnected"
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_emit_with_nonascii_name_node(app, status, warning):
|
||||
node = nodes.section(names=[u'\u65e5\u672c\u8a9e'])
|
||||
app.emit('my_event', node)
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_output(app, status, warning):
|
||||
# info with newline
|
||||
status.truncate(0) # __init__ writes to status
|
||||
@@ -71,7 +68,6 @@ def test_output(app, status, warning):
|
||||
assert app._warncount == old_count + 1
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_output_with_unencodable_char(app, status, warning):
|
||||
|
||||
class StreamWriter(codecs.StreamWriter):
|
||||
@@ -87,20 +83,17 @@ def test_output_with_unencodable_char(app, status, warning):
|
||||
assert status.getvalue() == "unicode ?...\n"
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_extensions(app, status, warning):
|
||||
app.setup_extension('shutil')
|
||||
assert strip_escseq(warning.getvalue()).startswith("WARNING: extension 'shutil'")
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_extension_in_blacklist(app, status, warning):
|
||||
app.setup_extension('sphinxjp.themecore')
|
||||
msg = strip_escseq(warning.getvalue())
|
||||
assert msg.startswith("WARNING: the extension 'sphinxjp.themecore' was")
|
||||
|
||||
|
||||
@with_app()
|
||||
def test_domain_override(app, status, warning):
|
||||
class A(Domain):
|
||||
name = 'foo'
|
||||
@@ -123,7 +116,7 @@ def test_domain_override(app, status, warning):
|
||||
assert 'new domain not a subclass of registered foo domain' in str(excinfo.value)
|
||||
|
||||
|
||||
@with_app(testroot='add_source_parser')
|
||||
@pytest.mark.sphinx(testroot='add_source_parser')
|
||||
def test_add_source_parser(app, status, warning):
|
||||
assert set(app.config.source_suffix) == set(['.rst', '.md', '.test'])
|
||||
assert set(app.config.source_parsers.keys()) == set(['.md', '.test'])
|
||||
@@ -131,7 +124,7 @@ def test_add_source_parser(app, status, warning):
|
||||
assert app.config.source_parsers['.test'].__name__ == 'TestSourceParser'
|
||||
|
||||
|
||||
@with_app(testroot='add_source_parser-conflicts-with-users-setting')
|
||||
@pytest.mark.sphinx(testroot='add_source_parser-conflicts-with-users-setting')
|
||||
def test_add_source_parser_conflicts_with_users_setting(app, status, warning):
|
||||
assert set(app.config.source_suffix) == set(['.rst', '.test'])
|
||||
assert set(app.config.source_parsers.keys()) == set(['.test'])
|
||||
|
||||
Reference in New Issue
Block a user