@@ -104,29 +104,22 @@ def f(x):
104
104
values = getfuncargnames (f )
105
105
assert values == ("x" ,)
106
106
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 ):
111
108
from _pytest .compat import getfuncargnames
109
+ from unittest .mock import patch
112
110
113
- def wrap ( f ) :
114
- def func ( ):
111
+ class T :
112
+ def original ( self , x , y , z ):
115
113
pass
116
114
117
- func .__wrapped__ = f
118
- func .patchings = ["qwe" ]
119
- return func
120
-
121
- @wrap
115
+ @patch .object (T , "original" )
122
116
def f (x , y , z ):
123
117
pass
124
118
125
119
values = getfuncargnames (f )
126
120
assert values == ("y" , "z" )
127
121
128
122
def test_unittest_mock (self , testdir ):
129
- pytest .importorskip ("unittest.mock" )
130
123
testdir .makepyfile (
131
124
"""
132
125
import unittest.mock
@@ -142,7 +135,6 @@ def test_hello(self, abspath):
142
135
reprec .assertoutcome (passed = 1 )
143
136
144
137
def test_unittest_mock_and_fixture (self , testdir ):
145
- pytest .importorskip ("unittest.mock" )
146
138
testdir .makepyfile (
147
139
"""
148
140
import os.path
@@ -164,7 +156,6 @@ def test_hello(inject_me):
164
156
reprec .assertoutcome (passed = 1 )
165
157
166
158
def test_unittest_mock_and_pypi_mock (self , testdir ):
167
- pytest .importorskip ("unittest.mock" )
168
159
pytest .importorskip ("mock" , "1.0.1" )
169
160
testdir .makepyfile (
170
161
"""
0 commit comments