Remove __multicall__ warning and usages in testing
pluggy>=0.5 already warns about those
This commit is contained in:
parent
11ec6aeafb
commit
3dc0da9339
|
@ -241,17 +241,6 @@ class PytestPluginManager(PluginManager):
|
||||||
"historic": hasattr(method, "historic")}
|
"historic": hasattr(method, "historic")}
|
||||||
return opts
|
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):
|
def register(self, plugin, name=None):
|
||||||
ret = super(PytestPluginManager, self).register(plugin, name)
|
ret = super(PytestPluginManager, self).register(plugin, name)
|
||||||
if ret:
|
if ret:
|
||||||
|
|
|
@ -809,10 +809,12 @@ class TestConftestCustomization(object):
|
||||||
def test_customized_pymakemodule_issue205_subdir(self, testdir):
|
def test_customized_pymakemodule_issue205_subdir(self, testdir):
|
||||||
b = testdir.mkdir("a").mkdir("b")
|
b = testdir.mkdir("a").mkdir("b")
|
||||||
b.join("conftest.py").write(_pytest._code.Source("""
|
b.join("conftest.py").write(_pytest._code.Source("""
|
||||||
def pytest_pycollect_makemodule(__multicall__):
|
import pytest
|
||||||
mod = __multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_pycollect_makemodule():
|
||||||
|
outcome = yield
|
||||||
|
mod = outcome.get_result()
|
||||||
mod.obj.hello = "world"
|
mod.obj.hello = "world"
|
||||||
return mod
|
|
||||||
"""))
|
"""))
|
||||||
b.join("test_module.py").write(_pytest._code.Source("""
|
b.join("test_module.py").write(_pytest._code.Source("""
|
||||||
def test_hello():
|
def test_hello():
|
||||||
|
|
|
@ -276,10 +276,12 @@ class TestPrunetraceback(object):
|
||||||
""")
|
""")
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
import pytest
|
import pytest
|
||||||
def pytest_make_collect_report(__multicall__):
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
rep = __multicall__.execute()
|
def pytest_make_collect_report():
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
rep.headerlines += ["header1"]
|
rep.headerlines += ["header1"]
|
||||||
return rep
|
outcome.set_result(rep)
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest(p)
|
result = testdir.runpytest(p)
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
|
|
|
@ -155,23 +155,6 @@ class TestPytestPluginInteractions(object):
|
||||||
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
|
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
|
||||||
assert ihook_a is not ihook_b
|
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):
|
def test_warn_on_deprecated_addhooks(self, pytestpm):
|
||||||
warnings = []
|
warnings = []
|
||||||
|
|
||||||
|
|
|
@ -637,12 +637,14 @@ def test_pytest_cmdline_main(testdir):
|
||||||
|
|
||||||
def test_unicode_in_longrepr(testdir):
|
def test_unicode_in_longrepr(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
import py
|
# -*- coding: utf-8 -*-
|
||||||
def pytest_runtest_makereport(__multicall__):
|
import pytest
|
||||||
rep = __multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_runtest_makereport():
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
if rep.when == "call":
|
if rep.when == "call":
|
||||||
rep.longrepr = py.builtin._totext("\\xc3\\xa4", "utf8")
|
rep.longrepr = u'ä'
|
||||||
return rep
|
|
||||||
""")
|
""")
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
def test_out():
|
def test_out():
|
||||||
|
|
|
@ -770,8 +770,10 @@ def test_no_teardown_if_setupclass_failed(testdir):
|
||||||
|
|
||||||
def test_issue333_result_clearing(testdir):
|
def test_issue333_result_clearing(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_runtest_call(__multicall__, item):
|
import pytest
|
||||||
__multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_runtest_call(item):
|
||||||
|
yield
|
||||||
assert 0
|
assert 0
|
||||||
""")
|
""")
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
Loading…
Reference in New Issue