diff --git a/_pytest/python.py b/_pytest/python.py index ddd9d78e6..10cb599c2 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -34,25 +34,17 @@ REGEX_TYPE = type(re.compile('')) if hasattr(inspect, 'signature'): - def _has_positional_arg(func): - sig = inspect.signature(func) - params = list(sig.parameters.values()) - if params: - return params[0].kind in (params[0].POSITIONAL_ONLY, - params[0].POSITIONAL_OR_KEYWORD) - else: - return False - def _format_args(func): return str(inspect.signature(func)) else: - def _has_positional_arg(func): - return bool(inspect.getargspec(func).args) - def _format_args(func): return inspect.formatargspec(*inspect.getargspec(func)) +def _has_positional_arg(func): + return func.__code__.co_argcount + + def filter_traceback(entry): return entry.path != cutdir1 and not entry.path.relto(cutdir2)