-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
plugin: monkeypatchrelated to the monkeypatch builtin pluginrelated to the monkeypatch builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
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:
pytest/src/_pytest/monkeypatch.py
Line 167 in 9424d88
if inspect.isclass(target): |
I'll put up a PR.
Metadata
Metadata
Assignees
Labels
plugin: monkeypatchrelated to the monkeypatch builtin pluginrelated to the monkeypatch builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed