Only consider actual functions when considering hooks

Fix #3775
This commit is contained in:
Bruno Oliveira
2018-08-04 16:35:24 -03:00
parent a76cc8f8c4
commit 2c0d2eef40
5 changed files with 28 additions and 0 deletions

View File

@@ -745,6 +745,24 @@ def test_get_plugin_specs_as_list():
assert _get_plugin_specs_as_list(("foo", "bar")) == ["foo", "bar"]
def test_collect_pytest_prefix_bug_integration(testdir):
"""Integration test for issue #3775"""
p = testdir.copy_example("config/collect_pytest_prefix")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines("* 1 passed *")
def test_collect_pytest_prefix_bug(pytestconfig):
"""Ensure we collect only actual functions from conftest files (#3775)"""
class Dummy(object):
class pytest_something(object):
pass
pm = pytestconfig.pluginmanager
assert pm.parse_hookimpl_opts(Dummy(), "pytest_something") is None
class TestWarning(object):
def test_warn_config(self, testdir):
testdir.makeconftest(