Skip to content

Commit 655151d

Browse files
wallacbeKenadia
authored andcommitted
add getfullargspec() for python3 (#701)
1 parent e1f9c1e commit 655151d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

openhtf/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,16 @@ def __call__(self, test_state):
525525
kwargs = dict(self.extra_kwargs)
526526
kwargs.update(test_state.plug_manager.provide_plugs(
527527
(plug.name, plug.cls) for plug in self.plugs if plug.update_kwargs))
528-
arg_info = inspect.getargspec(self.func)
528+
529+
if sys.version_info[0] < 3:
530+
arg_info = inspect.getargspec(self.func)
531+
keywords = arg_info.keywords
532+
else:
533+
arg_info = inspect.getfullargspec(self.func)
534+
keywords = arg_info.varkw
529535
# Pass in test_api if the phase takes *args, or **kwargs with at least 1
530536
# positional, or more positional args than we have keyword args.
531-
if arg_info.varargs or (arg_info.keywords and len(arg_info.args) >= 1) or (
537+
if arg_info.varargs or (keywords and len(arg_info.args) >= 1) or (
532538
len(arg_info.args) > len(kwargs)):
533539
# Underlying function has room for test_api as an arg. If it doesn't
534540
# expect it but we miscounted args, we'll get another error farther down.

0 commit comments

Comments
 (0)