@@ -176,7 +176,7 @@ async def redis_pool(create_redis_pool, loop):
176176 return await create_redis_pool ()
177177
178178
179- @pytest .yield_fixture
179+ @pytest .fixture
180180async def redis_client (create_redis_client , loop ):
181181 """Returns Redis client instance."""
182182 redis = await create_redis_client ()
@@ -206,7 +206,7 @@ async def _get_total_redis_connections():
206206 return _get_total_redis_connections
207207
208208
209- @pytest .yield_fixture
209+ @pytest .fixture
210210def _closable (loop ):
211211 conns = []
212212
@@ -225,7 +225,7 @@ def _closable(loop):
225225# Lightbus fixtures
226226
227227
228- @pytest .yield_fixture
228+ @pytest .fixture
229229def dummy_bus (loop , redis_server_url ):
230230 # fmt: off
231231 dummy_bus = lightbus .creation .create (
@@ -255,7 +255,7 @@ def dummy_bus(loop, redis_server_url):
255255 pass
256256
257257
258- @pytest .yield_fixture
258+ @pytest .fixture
259259async def dummy_listener (dummy_bus : BusPath , loop ):
260260 """Start the dummy bus consuming events"""
261261 # TODO: Remove. Barely used any more
@@ -375,7 +375,7 @@ def dummy_api():
375375 return DummyApi ()
376376
377377
378- @pytest .yield_fixture
378+ @pytest .fixture
379379def tmp_file ():
380380 f = NamedTemporaryFile ("r+" , encoding = "utf8" )
381381 yield f
@@ -385,7 +385,7 @@ def tmp_file():
385385 pass
386386
387387
388- @pytest .yield_fixture
388+ @pytest .fixture
389389def tmp_directory ():
390390 f = TemporaryDirectory ()
391391 yield Path (f .name )
@@ -410,7 +410,7 @@ def _set_env(**environ):
410410 return _set_env
411411
412412
413- @pytest .yield_fixture
413+ @pytest .fixture
414414def make_test_bus_module ():
415415 """Create a python module on disk which contains a bus, and put it on the python path"""
416416 created_modules = []
@@ -554,7 +554,7 @@ class Meta:
554554"""
555555
556556
557- @pytest .yield_fixture ()
557+ @pytest .fixture ()
558558async def redis_config_file (loop , redis_server_url , redis_client ):
559559 config = REDIS_BUS_CONFIG .format (redis_url = redis_server_url )
560560 with NamedTemporaryFile () as f :
@@ -564,15 +564,15 @@ async def redis_config_file(loop, redis_server_url, redis_client):
564564 await redis_client .execute (b"CLIENT" , b"KILL" , b"TYPE" , b"NORMAL" )
565565
566566
567- @pytest .yield_fixture ()
567+ @pytest .fixture ()
568568def debug_config_file ():
569569 with NamedTemporaryFile () as f :
570570 f .write (DEBUG_BUS_CONFIG .encode ("utf8" ))
571571 f .flush ()
572572 yield f .name
573573
574574
575- @pytest .yield_fixture ()
575+ @pytest .fixture ()
576576def run_lightbus_command (make_test_bus_module , redis_config_file ):
577577 processes = []
578578
@@ -658,7 +658,7 @@ def queue_mocker() -> Type[BusQueueMockerContext]:
658658 return BusQueueMockerContext
659659
660660
661- @pytest .yield_fixture ()
661+ @pytest .fixture ()
662662def error_queue ():
663663 queue = InternalQueue ()
664664 yield queue
@@ -705,7 +705,7 @@ async def worker_context(bus):
705705 return worker_context (bus )
706706
707707
708- @pytest .yield_fixture
708+ @pytest .fixture
709709async def worker (new_bus ):
710710 yield Worker (bus_factory = new_bus )
711711
@@ -803,7 +803,7 @@ def _docker_available():
803803 return docker_cmd .returncode == 0
804804
805805
806- @pytest .yield_fixture
806+ @pytest .fixture
807807def standalone_redis_server ():
808808 if not _docker_available ():
809809 raise pytest .skip ("Docker not available" )
0 commit comments