Skip to content

Commit ef5b733

Browse files
committed
Fix unmagic fixture wrapping on pytest>=8.4
1 parent 1249153 commit ef5b733

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/unmagic/_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
get_real_func,
44
safe_getattr,
55
safe_isclass,
6-
_PytestWrapper as Wrapper,
76
)
87
from _pytest.fixtures import (
98
_get_direct_parametrize_args as get_direct_parametrize_args,

src/unmagic/fixtures.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ def create(cls, fixture, scope="function", autouse=False):
142142
def func():
143143
with fixture as value:
144144
yield value
145-
func.__pytest_wrapped__ = _api.Wrapper(wrapped)
146145
func.__unmagic_wrapped__ = outer
147-
# delete __wrapped__ to prevent pytest from
148-
# introspecting arguments from wrapped function
149-
del func.__wrapped__
146+
func.__wrapped__ = wrapped
147+
# pytest from introspecting arguments from wrapped function
148+
func.__signature__ = None
150149
return cls(func, scope, autouse)
151150

152151
def __init__(self, func, scope, autouse):
@@ -164,11 +163,6 @@ def _id(self):
164163
def unmagic_fixtures(self):
165164
return self.func.unmagic_fixtures
166165

167-
@property
168-
def __pytest_wrapped__(self):
169-
wrapped = getattr(self.func, "__pytest_wrapped__", None)
170-
return _api.Wrapper(self.func) if wrapped is None else wrapped
171-
172166
@property
173167
def __name__(self):
174168
return self.func.__name__

0 commit comments

Comments
 (0)