Remove __multicall__ warning and usages in testing

pluggy>=0.5 already warns about those
This commit is contained in:
Bruno Oliveira 2017-08-30 20:23:55 -03:00
parent 11ec6aeafb
commit 3dc0da9339
6 changed files with 21 additions and 41 deletions

View File

@ -241,17 +241,6 @@ class PytestPluginManager(PluginManager):
"historic": hasattr(method, "historic")}
return opts
def _verify_hook(self, hook, hookmethod):
super(PytestPluginManager, self)._verify_hook(hook, hookmethod)
if "__multicall__" in hookmethod.argnames:
fslineno = _pytest._code.getfslineno(hookmethod.function)
warning = dict(code="I1",
fslocation=fslineno,
nodeid=None,
message="%r hook uses deprecated __multicall__ "
"argument" % (hook.name))
self._warn(warning)
def register(self, plugin, name=None):
ret = super(PytestPluginManager, self).register(plugin, name)
if ret:

View File

@ -809,10 +809,12 @@ class TestConftestCustomization(object):
def test_customized_pymakemodule_issue205_subdir(self, testdir):
b = testdir.mkdir("a").mkdir("b")
b.join("conftest.py").write(_pytest._code.Source("""
def pytest_pycollect_makemodule(__multicall__):
mod = __multicall__.execute()
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_pycollect_makemodule():
outcome = yield
mod = outcome.get_result()
mod.obj.hello = "world"
return mod
"""))
b.join("test_module.py").write(_pytest._code.Source("""
def test_hello():

View File

@ -276,10 +276,12 @@ class TestPrunetraceback(object):
""")
testdir.makeconftest("""
import pytest
def pytest_make_collect_report(__multicall__):
rep = __multicall__.execute()
@pytest.hookimpl(hookwrapper=True)
def pytest_make_collect_report():
outcome = yield
rep = outcome.get_result()
rep.headerlines += ["header1"]
return rep
outcome.set_result(rep)
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([

View File

@ -155,23 +155,6 @@ class TestPytestPluginInteractions(object):
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
assert ihook_a is not ihook_b
def test_warn_on_deprecated_multicall(self, pytestpm):
warnings = []
class get_warnings(object):
def pytest_logwarning(self, message):
warnings.append(message)
class Plugin(object):
def pytest_configure(self, __multicall__):
pass
pytestpm.register(get_warnings())
before = list(warnings)
pytestpm.register(Plugin())
assert len(warnings) == len(before) + 1
assert "deprecated" in warnings[-1]
def test_warn_on_deprecated_addhooks(self, pytestpm):
warnings = []

View File

@ -637,12 +637,14 @@ def test_pytest_cmdline_main(testdir):
def test_unicode_in_longrepr(testdir):
testdir.makeconftest("""
import py
def pytest_runtest_makereport(__multicall__):
rep = __multicall__.execute()
# -*- coding: utf-8 -*-
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport():
outcome = yield
rep = outcome.get_result()
if rep.when == "call":
rep.longrepr = py.builtin._totext("\\xc3\\xa4", "utf8")
return rep
rep.longrepr = u'ä'
""")
testdir.makepyfile("""
def test_out():

View File

@ -770,8 +770,10 @@ def test_no_teardown_if_setupclass_failed(testdir):
def test_issue333_result_clearing(testdir):
testdir.makeconftest("""
def pytest_runtest_call(__multicall__, item):
__multicall__.execute()
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(item):
yield
assert 0
""")
testdir.makepyfile("""