Skip to content

Commit 34d4aae

Browse files
committed
refactor: Removed obsolete "unittest" argument from _perhabs_rebind_fixture_func
1 parent 80748a5 commit 34d4aae

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pytest_asyncio/plugin.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ def _add_kwargs(
291291
return ret
292292

293293

294-
def _perhaps_rebind_fixture_func(
295-
func: _T, instance: Optional[Any], unittest: bool
296-
) -> _T:
294+
def _perhaps_rebind_fixture_func(func: _T, instance: Optional[Any]) -> _T:
297295
if instance is not None:
298296
# The fixture needs to be bound to the actual request.instance
299297
# so it is bound to the same object as the test method.
@@ -302,10 +300,9 @@ def _perhaps_rebind_fixture_func(
302300
unbound, cls = func.__func__, type(func.__self__) # type: ignore
303301
except AttributeError:
304302
pass
305-
# If unittest is true, the fixture is bound unconditionally.
306-
# otherwise, only if the fixture was bound before to an instance of
303+
# Only if the fixture was bound before to an instance of
307304
# the same type.
308-
if unittest or (cls is not None and isinstance(instance, cls)):
305+
if cls is not None and isinstance(instance, cls):
309306
func = unbound.__get__(instance) # type: ignore
310307
return func
311308

@@ -315,7 +312,7 @@ def _wrap_asyncgen_fixture(fixturedef: FixtureDef) -> None:
315312

316313
@functools.wraps(fixture)
317314
def _asyncgen_fixture_wrapper(request: FixtureRequest, **kwargs: Any):
318-
func = _perhaps_rebind_fixture_func(fixture, request.instance, False)
315+
func = _perhaps_rebind_fixture_func(fixture, request.instance)
319316
event_loop_fixture_id = _get_event_loop_fixture_id_for_async_fixture(
320317
request, func
321318
)
@@ -354,7 +351,7 @@ def _wrap_async_fixture(fixturedef: FixtureDef) -> None:
354351

355352
@functools.wraps(fixture)
356353
def _async_fixture_wrapper(request: FixtureRequest, **kwargs: Any):
357-
func = _perhaps_rebind_fixture_func(fixture, request.instance, False)
354+
func = _perhaps_rebind_fixture_func(fixture, request.instance)
358355
event_loop_fixture_id = _get_event_loop_fixture_id_for_async_fixture(
359356
request, func
360357
)

0 commit comments

Comments
 (0)