diff --git a/tests/sync/sync_test.py b/tests/sync/sync_test.py index 9a05427a..2c919f40 100644 --- a/tests/sync/sync_test.py +++ b/tests/sync/sync_test.py @@ -43,6 +43,8 @@ from syftbox.client.client import app as client_app from syftbox.client.client import lifespan as client_lifespan +from syftbox.client.plugins.create_datasite import run as run_create_datasite_plugin +from syftbox.client.plugins.init import run as run_init_plugin from syftbox.client.plugins.sync import do_sync from syftbox.lib.lib import ClientConfig, perm_file_path from syftbox.server.server import app as server_app @@ -67,7 +69,7 @@ def datasite_1( sync_folder=str(client_path / "sync"), email=email, server_url=str(server_client.base_url), - autorun_plugins=["init", "create_datasite"], + autorun_plugins=[], ) client_config._server_client = server_client @@ -78,6 +80,12 @@ def datasite_1( yield client +def setup_datasite(datasite: TestClient): + run_init_plugin(datasite.app.shared_state) + run_create_datasite_plugin(datasite.app.shared_state) + wait_for_datasite_setup(datasite) + + @pytest.fixture(scope="function") def server_client(tmp_path: Path) -> Generator[TestClient, None, None]: path = tmp_path / "server" @@ -97,7 +105,7 @@ def http_server_client(): yield client -def wait_for_datasite_setup(datasite: TestClient, timeout=20): +def wait_for_datasite_setup(datasite: TestClient, timeout=5): print("waiting for datasite setup...") client_config: ClientConfig = datasite.app.shared_state.client_config @@ -127,8 +135,7 @@ def test_sync_file_to_server_snapshot( tmp_path: Path, server_client: TestClient, datasite_1: TestClient ): print(datasite_1.app.shared_state.client_config) - - wait_for_datasite_setup(datasite_1) + setup_datasite(datasite_1) do_sync(datasite_1.app.shared_state)