Fix #1809: skip patching staticmethods
This commit is contained in:
parent
28aa5d34b0
commit
0ac989cfd4
1 changed files with 11 additions and 0 deletions
|
|
@ -89,6 +89,17 @@ class BaseMockAWS(object):
|
||||||
if inspect.ismethod(attr_value) and attr_value.__self__ is klass:
|
if inspect.ismethod(attr_value) and attr_value.__self__ is klass:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Check if this is a staticmethod. If so, skip patching
|
||||||
|
for cls in inspect.getmro(klass):
|
||||||
|
if attr_value.__name__ not in cls.__dict__:
|
||||||
|
continue
|
||||||
|
bound_attr_value = cls.__dict__[attr_value.__name__]
|
||||||
|
if not isinstance(bound_attr_value, staticmethod):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# It is a staticmethod, skip patching
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
setattr(klass, attr, self(attr_value, reset=False))
|
setattr(klass, attr, self(attr_value, reset=False))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue