@@ -24,6 +24,13 @@ def test_global_configuration_works() -> None:
24
24
is service_locator .get_configuration ()
25
25
)
26
26
27
+ assert (
28
+ service_locator .get_configuration ()
29
+ is service_locator .get_configuration ()
30
+ is Configuration .get_global_configuration ()
31
+ is Configuration .get_global_configuration ()
32
+ )
33
+
27
34
28
35
async def test_storage_not_persisted_when_disabled (tmp_path : Path , httpbin : URL ) -> None :
29
36
config = Configuration (
@@ -32,9 +39,8 @@ async def test_storage_not_persisted_when_disabled(tmp_path: Path, httpbin: URL)
32
39
crawlee_storage_dir = str (tmp_path ), # type: ignore[call-arg]
33
40
)
34
41
storage_client = MemoryStorageClient .from_config (config )
35
- service_locator .set_storage_client (storage_client )
36
42
37
- crawler = HttpCrawler ()
43
+ crawler = HttpCrawler (storage_client = storage_client )
38
44
39
45
@crawler .router .default_handler
40
46
async def default_handler (context : HttpCrawlingContext ) -> None :
@@ -54,9 +60,8 @@ async def test_storage_persisted_when_enabled(tmp_path: Path, httpbin: URL) -> N
54
60
crawlee_storage_dir = str (tmp_path ), # type: ignore[call-arg]
55
61
)
56
62
storage_client = MemoryStorageClient .from_config (config )
57
- service_locator .set_storage_client (storage_client )
58
63
59
- crawler = HttpCrawler ()
64
+ crawler = HttpCrawler (storage_client = storage_client )
60
65
61
66
@crawler .router .default_handler
62
67
async def default_handler (context : HttpCrawlingContext ) -> None :
0 commit comments