Update test_getfuncargnames_patching to work with modern mock
This commit is contained in:
parent
8a3f40996a
commit
65c23017c7
|
@ -104,21 +104,15 @@ class TestMockDecoration:
|
||||||
values = getfuncargnames(f)
|
values = getfuncargnames(f)
|
||||||
assert values == ("x",)
|
assert values == ("x",)
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
def test_getfuncargnames_patching(self):
|
||||||
strict=False, reason="getfuncargnames breaks if mock is imported"
|
|
||||||
)
|
|
||||||
def test_wrapped_getfuncargnames_patching(self):
|
|
||||||
from _pytest.compat import getfuncargnames
|
from _pytest.compat import getfuncargnames
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
def wrap(f):
|
class T:
|
||||||
def func():
|
def original(self, x, y, z):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func.__wrapped__ = f
|
@patch.object(T, "original")
|
||||||
func.patchings = ["qwe"]
|
|
||||||
return func
|
|
||||||
|
|
||||||
@wrap
|
|
||||||
def f(x, y, z):
|
def f(x, y, z):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue