Skip to content

Commit 65c2301

Browse files
committed
Update test_getfuncargnames_patching to work with modern mock
1 parent 8a3f409 commit 65c2301

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

testing/python/integration.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,15 @@ def f(x):
104104
values = getfuncargnames(f)
105105
assert values == ("x",)
106106

107-
@pytest.mark.xfail(
108-
strict=False, reason="getfuncargnames breaks if mock is imported"
109-
)
110-
def test_wrapped_getfuncargnames_patching(self):
107+
def test_getfuncargnames_patching(self):
111108
from _pytest.compat import getfuncargnames
109+
from unittest.mock import patch
112110

113-
def wrap(f):
114-
def func():
111+
class T:
112+
def original(self, x, y, z):
115113
pass
116114

117-
func.__wrapped__ = f
118-
func.patchings = ["qwe"]
119-
return func
120-
121-
@wrap
115+
@patch.object(T, "original")
122116
def f(x, y, z):
123117
pass
124118

0 commit comments

Comments
 (0)