From 573c2088d22e4e846bbb57840ae65d9cd7a72043 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 14 Nov 2024 12:51:51 +0200 Subject: [PATCH] :art: Replace deprecated `scope` keyword with `loop_scope` Signed-off-by: ff137 --- acapy_agent/multitenant/admin/tests/test_routes.py | 4 ++-- .../v1_0/handlers/tests/test_response_handler.py | 10 +++++----- .../examples/tests/test_mediator_ping_agents.py | 14 +++++++------- demo/playground/examples/tests/test_ping_agents.py | 14 +++++++------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/acapy_agent/multitenant/admin/tests/test_routes.py b/acapy_agent/multitenant/admin/tests/test_routes.py index 87dcdde88d..2431e6f6d5 100644 --- a/acapy_agent/multitenant/admin/tests/test_routes.py +++ b/acapy_agent/multitenant/admin/tests/test_routes.py @@ -143,7 +143,7 @@ async def test_wallets_list_query(self): } ) - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") async def test_wallet_create_tenant_settings(self): body = { "wallet_name": "test", @@ -796,7 +796,7 @@ async def test_wallet_create_token_x(self): ) await test_module.wallet_create_token(self.request) - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") async def test_wallet_remove_managed(self): self.request.has_body = False self.request.match_info = {"wallet_id": "dummy"} diff --git a/acapy_agent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py b/acapy_agent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py index d177e2109f..87abd74791 100644 --- a/acapy_agent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py +++ b/acapy_agent/protocols/didexchange/v1_0/handlers/tests/test_response_handler.py @@ -75,7 +75,7 @@ async def asyncSetUp(self): did_doc_attach=self.did_doc_attach, ) - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") @mock.patch.object(test_module, "DIDXManager") async def test_called(self, mock_didx_mgr): mock_didx_mgr.return_value.accept_response = mock.CoroutineMock() @@ -89,7 +89,7 @@ async def test_called(self, mock_didx_mgr): ) assert not responder.messages - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") @mock.patch.object(test_module, "DIDXManager") async def test_called_auto_ping(self, mock_didx_mgr): self.ctx.update_settings({"auto_ping_connection": True}) @@ -107,7 +107,7 @@ async def test_called_auto_ping(self, mock_didx_mgr): result, _ = messages[0] assert isinstance(result, Ping) - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") @mock.patch.object(test_module, "DIDXManager") @mock.patch.object(connection_target, "ConnectionTarget") async def test_problem_report(self, mock_conn_target, mock_didx_mgr): @@ -144,7 +144,7 @@ async def test_problem_report(self, mock_conn_target, mock_didx_mgr): ) assert target == {"target_list": [mock_conn_target]} - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") @mock.patch.object(test_module, "DIDXManager") @mock.patch.object(connection_target, "ConnectionTarget") async def test_problem_report_did_doc( @@ -191,7 +191,7 @@ async def test_problem_report_did_doc( ) assert target == {"target_list": [mock_conn_target]} - @pytest.mark.asyncio(scope="function") + @pytest.mark.asyncio(loop_scope="function") @mock.patch.object(test_module, "DIDXManager") @mock.patch.object(connection_target, "ConnectionTarget") async def test_problem_report_did_doc_no_conn_target( diff --git a/demo/playground/examples/tests/test_mediator_ping_agents.py b/demo/playground/examples/tests/test_mediator_ping_agents.py index d734dc14d7..7b1a1c4af5 100644 --- a/demo/playground/examples/tests/test_mediator_ping_agents.py +++ b/demo/playground/examples/tests/test_mediator_ping_agents.py @@ -16,21 +16,21 @@ logger.info("start testing mediated connections...") -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def faber(): """faber agent fixture.""" logger.info(f"faber = {FABER}") yield Agent(FABER) -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def alice(): """resolver agent fixture.""" logger.info(f"alice = {ALICE}") yield Agent(ALICE) -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def multi_one(): """resolver agent fixture.""" agent = Agent(MULTI) @@ -42,7 +42,7 @@ def multi_one(): yield agent -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def mediation_invite(): invitation_url = os.getenv("MEDIATOR_INVITATION_URL") logger.info(f"MEDIATOR_INVITATION_URL = {invitation_url}") @@ -97,7 +97,7 @@ def initialize_mediation(agent: Agent, invitation): return result -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def faber_mediator(faber, mediation_invite): logger.info("faber_mediator...") result = initialize_mediation(faber, mediation_invite) @@ -105,7 +105,7 @@ def faber_mediator(faber, mediation_invite): yield result -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def alice_mediator(alice, mediation_invite): logger.info("alice_mediator...") result = initialize_mediation(alice, mediation_invite) @@ -113,7 +113,7 @@ def alice_mediator(alice, mediation_invite): yield result -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def multi_one_mediator(multi_one, mediation_invite): logger.info("multi_one_mediator...") result = initialize_mediation(multi_one, mediation_invite) diff --git a/demo/playground/examples/tests/test_ping_agents.py b/demo/playground/examples/tests/test_ping_agents.py index 64cb4cdad1..13846181f8 100644 --- a/demo/playground/examples/tests/test_ping_agents.py +++ b/demo/playground/examples/tests/test_ping_agents.py @@ -11,19 +11,19 @@ from . import ALICE, FABER, MULTI, Agent, logger -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def faber(): """faber agent fixture.""" yield Agent(FABER) -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def alice(): """resolver agent fixture.""" yield Agent(ALICE) -@pytest.fixture(scope="session") +@pytest.fixture(loop_scope="session") def multi_one(): """resolver agent fixture.""" agent = Agent(MULTI) @@ -35,7 +35,7 @@ def multi_one(): yield agent -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(loop_scope="session", autouse=True) def alice_faber_connection(faber, alice): """Established connection filter.""" logger.info("faber create invitation to alice") @@ -48,7 +48,7 @@ def alice_faber_connection(faber, alice): return result -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(loop_scope="session", autouse=True) def faber_alice_connection(faber, alice): """Established connection filter.""" logger.info("alice create invitation to faber") @@ -61,7 +61,7 @@ def faber_alice_connection(faber, alice): return result -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(loop_scope="session", autouse=True) def alice_multi_one_connection(multi_one, alice): """Established connection filter.""" logger.info("multi_one create invitation to alice") @@ -74,7 +74,7 @@ def alice_multi_one_connection(multi_one, alice): return result -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(loop_scope="session", autouse=True) def multi_one_alice_connection(multi_one, alice): """Established connection filter.""" logger.info("alice create invitation to multi_one")