From 65c23017c7a3a95d147cc2a54aa1e031f4ba2f34 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 15 Jul 2019 12:23:59 -0300 Subject: [PATCH] Update test_getfuncargnames_patching to work with modern mock --- testing/python/integration.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/testing/python/integration.py b/testing/python/integration.py index 0a816bb95..a6b8dddf3 100644 --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -104,21 +104,15 @@ class TestMockDecoration: values = getfuncargnames(f) assert values == ("x",) - @pytest.mark.xfail( - strict=False, reason="getfuncargnames breaks if mock is imported" - ) - def test_wrapped_getfuncargnames_patching(self): + def test_getfuncargnames_patching(self): from _pytest.compat import getfuncargnames + from unittest.mock import patch - def wrap(f): - def func(): + class T: + def original(self, x, y, z): pass - func.__wrapped__ = f - func.patchings = ["qwe"] - return func - - @wrap + @patch.object(T, "original") def f(x, y, z): pass