The following example fails
class SampleParent(object):
@classmethod
def hello(_cls):
pass
class SampleChild(SampleParent):
pass
monkeypatch = MonkeyPatch()
original = SampleChild.hello
monkeypatch.delattr(SampleParent, 'hello')
monkeypatch.undo()
assert original == SampleChild.hello
This issue was fixed for setattr via #156
We need to make a similar check in delattr as seen here:
|
if inspect.isclass(target): |
I'll put up a PR.
The following example fails
This issue was fixed for setattr via #156
We need to make a similar check in delattr as seen here:
pytest/src/_pytest/monkeypatch.py
Line 167 in 9424d88
I'll put up a PR.