-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few minor fixes #224
A few minor fixes #224
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,7 +161,7 @@ def varnames(func): | |
try: | ||
func = getattr(func, "__call__", func) | ||
except Exception: | ||
return () | ||
return (), () | ||
|
||
try: # func MUST be a function or method here or we won't parse any args | ||
spec = _getargspec(func) | ||
|
@@ -171,9 +171,9 @@ def varnames(func): | |
args, defaults = tuple(spec.args), spec.defaults | ||
if defaults: | ||
index = -len(defaults) | ||
args, defaults = args[:index], tuple(args[index:]) | ||
args, kwargs = args[:index], tuple(args[index:]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed that this name is better. |
||
else: | ||
defaults = () | ||
kwargs = () | ||
|
||
# strip any implicit instance arg | ||
# pypy3 uses "obj" instead of "self" for default dunder methods | ||
|
@@ -185,10 +185,10 @@ def varnames(func): | |
args = args[1:] | ||
|
||
try: | ||
cache["_varnames"] = args, defaults | ||
cache["_varnames"] = args, kwargs | ||
except TypeError: | ||
pass | ||
return args, defaults | ||
return args, kwargs | ||
|
||
|
||
class _HookRelay(object): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
import pytest | ||
from pluggy import HookCallError, HookspecMarker, HookimplMarker | ||
from pluggy.hooks import HookImpl | ||
from pluggy.callers import _multicall, _legacymulticall, _LegacyMultiCall | ||
from pluggy.callers import _multicall, _legacymulticall | ||
|
||
|
||
hookspec = HookspecMarker("example") | ||
hookimpl = HookimplMarker("example") | ||
|
||
|
||
def test_uses_copy_of_methods(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test has a typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. |
||
out = [lambda: 42] | ||
mc = _LegacyMultiCall(out, {}) | ||
repr(mc) | ||
out[:] = [] | ||
res = mc.execute() | ||
return res == 42 | ||
|
||
|
||
def MC(methods, kwargs, firstresult=False): | ||
caller = _multicall | ||
hookfuncs = [] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!