This patch includes a test for the behavior of subclasses whose parents contain wrapped classmethods.
The subclass's classmethod should be bound to the subclass, but wrapt appears to call getattr on the parent class before wrapping which results in the binding of the classmethod. This behavior is described in changes.rst (copied below) and the implementation comments but I think there may have been a typo in the implementation. After this patch, wrapping classmethods appears to function normally.
From changes.rst:
The FunctionWrapper was not always working when applied around a method of a class type by accessing the method to be wrapped using getattr(). Instead it is necessary to access the original unbound method from the class dict. Updated the FunctionWrapper to work better in such situations, but also modify resolve_path() to always grab the class method from the class dict when wrapping methods using wrapt.wrap_object() so wrapping is more predictable. When doing monkey patching wrapt.wrap_object() should always be used to ensure correct operation.
Coverage increased (+0.04%) to 93.395% when pulling 33148ea028b7a915bb0294c6c49773d4168e96d8 on a-feld:fix-inherited-classmethod into b2e4759d31b3e4815077f03aeefea9ceadc67530 on GrahamDumpleton:develop.
This patch includes a test for the behavior of subclasses whose parents contain wrapped classmethods.
The subclass's classmethod should be bound to the subclass, but wrapt appears to call
getattr
on the parent class before wrapping which results in the binding of the classmethod. This behavior is described inchanges.rst
(copied below) and the implementation comments but I think there may have been a typo in the implementation. After this patch, wrapping classmethods appears to function normally.From
changes.rst
: