@@ -67,7 +67,6 @@ async def test_aliases_not_stored_on_platform_when_local(
6767) -> None :
6868 """Test that default Apify storage used locally is not persisting aliases to Apify based default KVS."""
6969 service_locator .set_configuration (Configuration (token = apify_token ))
70- service_locator .set_storage_client (ApifyStorageClient ())
7170 async with Actor (configure_logging = False ):
7271 await storage_type .open (alias = 'test' )
7372 default_kvs = await Actor .open_key_value_store (force_cloud = True )
@@ -111,23 +110,12 @@ async def test_actor_full_explicit_storage_init_same_client(apify_token: str) ->
111110async def test_actor_partial_explicit_cloud_storage_init (apify_token : str ) -> None :
112111 service_locator .set_configuration (Configuration (token = apify_token ))
113112 service_locator .set_storage_client (ApifyStorageClient (request_queue_access = 'shared' ))
114- async with Actor :
115- # If service locator was already set with ApifyStorageClient, the actor will use it as cloud_storage_client of
116- # SmartApifyStorageClient
117- assert await Actor .open_dataset () is not await Actor .open_dataset (force_cloud = True )
118- assert await Actor .open_key_value_store () is not await Actor .open_key_value_store (force_cloud = True )
119- assert await Actor .open_request_queue () is not await Actor .open_request_queue (force_cloud = True )
120-
121-
122- async def test_actor_partial_explicit_local_storage_init (apify_token : str ) -> None :
123- service_locator .set_configuration (Configuration (token = apify_token ))
124- service_locator .set_storage_client (MemoryStorageClient ())
125- async with Actor :
126- # If service locator was already set with non-ApifyStorageClient, the actor will use it as local_storage_client
127- # of SmartApifyStorageClient
128- assert await Actor .open_dataset () is not await Actor .open_dataset (force_cloud = True )
129- assert await Actor .open_key_value_store () is not await Actor .open_key_value_store (force_cloud = True )
130- assert await Actor .open_request_queue () is not await Actor .open_request_queue (force_cloud = True )
113+ with pytest .raises (
114+ RuntimeError , match = r'^The storage client in the service locator has to be instance of SmartApifyStorageClient'
115+ ):
116+ async with Actor :
117+ # If service locator was explicitly set to something different than SmartApifyStorageClient, raise an error.
118+ ...
131119
132120
133121async def test_actor_implicit_storage_init (apify_token : str ) -> None :
0 commit comments