Merge remote-tracking branch 'upstream/master' into features
This commit is contained in:
@@ -101,14 +101,28 @@ def test_metafunc_addcall_deprecated(testdir):
|
||||
])
|
||||
|
||||
|
||||
def test_pytest_catchlog_deprecated(testdir):
|
||||
def test_terminal_reporter_writer_attr(pytestconfig):
|
||||
"""Check that TerminalReporter._tw is also available as 'writer' (#2984)
|
||||
This attribute is planned to be deprecated in 3.4.
|
||||
"""
|
||||
try:
|
||||
import xdist # noqa
|
||||
pytest.skip('xdist workers disable the terminal reporter plugin')
|
||||
except ImportError:
|
||||
pass
|
||||
terminal_reporter = pytestconfig.pluginmanager.get_plugin('terminalreporter')
|
||||
assert terminal_reporter.writer is terminal_reporter._tw
|
||||
|
||||
|
||||
@pytest.mark.parametrize('plugin', ['catchlog', 'capturelog'])
|
||||
def test_pytest_catchlog_deprecated(testdir, plugin):
|
||||
testdir.makepyfile("""
|
||||
def test_func(pytestconfig):
|
||||
pytestconfig.pluginmanager.register(None, 'pytest_catchlog')
|
||||
""")
|
||||
pytestconfig.pluginmanager.register(None, 'pytest_{0}')
|
||||
""".format(plugin))
|
||||
res = testdir.runpytest()
|
||||
assert res.ret == 0
|
||||
res.stdout.fnmatch_lines([
|
||||
"*pytest-catchlog plugin has been merged into the core*",
|
||||
"*pytest-*log plugin has been merged into the core*",
|
||||
"*1 passed, 1 warnings*",
|
||||
])
|
||||
|
||||
@@ -988,6 +988,24 @@ class TestProgress:
|
||||
""",
|
||||
)
|
||||
|
||||
def test_zero_tests_collected(self, testdir):
|
||||
"""Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being
|
||||
actually collected (#2971)."""
|
||||
testdir.makeconftest("""
|
||||
def pytest_collection_modifyitems(items, config):
|
||||
from _pytest.runner import CollectReport
|
||||
for node_id in ('nodeid1', 'nodeid2'):
|
||||
rep = CollectReport(node_id, 'passed', None, None)
|
||||
rep.when = 'passed'
|
||||
rep.duration = 0.1
|
||||
config.hook.pytest_runtest_logreport(report=rep)
|
||||
""")
|
||||
output = testdir.runpytest()
|
||||
assert 'ZeroDivisionError' not in output.stdout.str()
|
||||
output.stdout.fnmatch_lines([
|
||||
'=* 2 passed in *=',
|
||||
])
|
||||
|
||||
def test_normal(self, many_tests_file, testdir):
|
||||
output = testdir.runpytest()
|
||||
output.stdout.re_match_lines([
|
||||
|
||||
Reference in New Issue
Block a user