From b2b84bcd138072911c40acd579c37fba9962519b Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Sun, 22 Oct 2023 15:22:25 +0800 Subject: [PATCH] Remove autouse from fixtures --- packages/syft/tests/conftest.py | 16 ++++++++-------- .../syft/tests/syft/notifications/fixtures.py | 12 ++++++------ packages/syft/tests/syft/users/fixtures.py | 18 +++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/syft/tests/conftest.py b/packages/syft/tests/conftest.py index 49d19b1049f..3fceb149e8e 100644 --- a/packages/syft/tests/conftest.py +++ b/packages/syft/tests/conftest.py @@ -67,43 +67,43 @@ def stage_protocol(protocol_file: Path): dp.save_history(dp.protocol_history) -@pytest.fixture(autouse=True) +@pytest.fixture() def worker(faker, stage_protocol): return sy.Worker.named(name=faker.name()) -@pytest.fixture(autouse=True) +@pytest.fixture() def root_domain_client(worker): return worker.root_client -@pytest.fixture(autouse=True) +@pytest.fixture() def root_verify_key(worker): return worker.root_client.credentials.verify_key -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_client(worker): return worker.guest_client -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_verify_key(worker): return worker.guest_client.credentials.verify_key -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_domain_client(root_domain_client): return root_domain_client.guest() -@pytest.fixture(autouse=True) +@pytest.fixture() def document_store(worker): yield worker.document_store worker.document_store.reset() -@pytest.fixture(autouse=True) +@pytest.fixture() def action_store(worker): return worker.action_store diff --git a/packages/syft/tests/syft/notifications/fixtures.py b/packages/syft/tests/syft/notifications/fixtures.py index 9d4af1bfa8c..fd3722f5e1d 100644 --- a/packages/syft/tests/syft/notifications/fixtures.py +++ b/packages/syft/tests/syft/notifications/fixtures.py @@ -22,22 +22,22 @@ test_verify_key = SyftVerifyKey.from_string(test_verify_key_string) -@pytest.fixture(autouse=True) +@pytest.fixture() def notification_stash(document_store): return NotificationStash(store=document_store) -@pytest.fixture(autouse=True) +@pytest.fixture() def notification_service(document_store): return NotificationService(store=document_store) -@pytest.fixture(autouse=True) +@pytest.fixture() def authed_context(admin_user: User, worker: Worker) -> AuthedServiceContext: return AuthedServiceContext(credentials=test_verify_key, node=worker) -@pytest.fixture(autouse=True) +@pytest.fixture() def linked_object(): return LinkedObject( node_uid=UID(), @@ -47,7 +47,7 @@ def linked_object(): ) -@pytest.fixture(autouse=True) +@pytest.fixture() def mock_create_notification(faker) -> CreateNotification: test_signing_key1 = SyftSigningKey.generate() test_verify_key1 = test_signing_key1.verify_key @@ -66,7 +66,7 @@ def mock_create_notification(faker) -> CreateNotification: return mock_notification -@pytest.fixture(autouse=True) +@pytest.fixture() def mock_notification( root_verify_key, notification_stash: NotificationStash, diff --git a/packages/syft/tests/syft/users/fixtures.py b/packages/syft/tests/syft/users/fixtures.py index b5b0ac67509..fa0958fd630 100644 --- a/packages/syft/tests/syft/users/fixtures.py +++ b/packages/syft/tests/syft/users/fixtures.py @@ -19,7 +19,7 @@ from syft.store.document_store import DocumentStore -@pytest.fixture(autouse=True) +@pytest.fixture() def admin_create_user(faker) -> UserCreate: password = faker.password() user_create = UserCreate( @@ -34,7 +34,7 @@ def admin_create_user(faker) -> UserCreate: return user_create -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_create_user(faker) -> UserCreate: password = faker.password() user_create = UserCreate( @@ -49,25 +49,25 @@ def guest_create_user(faker) -> UserCreate: return user_create -@pytest.fixture(autouse=True) +@pytest.fixture() def admin_user(admin_create_user) -> User: user = admin_create_user.to(User) return user -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_user(guest_create_user) -> User: user = guest_create_user.to(User) return user -@pytest.fixture(autouse=True) +@pytest.fixture() def admin_view_user(admin_user) -> UserView: user_view = admin_user.to(UserView) return user_view -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_view_user(guest_user) -> UserView: user_view = guest_user.to(UserView) return user_view @@ -90,7 +90,7 @@ def guest_user_private_key(guest_user) -> UserPrivateKey: ) -@pytest.fixture(autouse=True) +@pytest.fixture() def update_user(faker) -> UserSearch: return UserUpdate( name=faker.name(), @@ -98,14 +98,14 @@ def update_user(faker) -> UserSearch: ) -@pytest.fixture(autouse=True) +@pytest.fixture() def guest_user_search(guest_user) -> UserSearch: return UserSearch( name=guest_user.name, email=guest_user.email, verify_key=guest_user.verify_key ) -@pytest.fixture(autouse=True) +@pytest.fixture() def user_stash(document_store: DocumentStore) -> UserStash: return UserStash(store=document_store)