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

@@ -1,6 +1,7 @@
""" command line options, ini-file and conftest.py processing. """
from __future__ import absolute_import, division, print_function
import argparse
import inspect
import shlex
import traceback
import types
@@ -252,6 +253,10 @@ class PytestPluginManager(PluginManager):
method = getattr(plugin, name)
opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
# consider only actual functions for hooks (#3775)
if not inspect.isroutine(method):
return
# collect unmarked hooks as long as they have the `pytest_' prefix
if opts is None and name.startswith("pytest_"):
opts = {}