MCPcopy
hub / github.com/scrapy/scrapy / test_lazy_handlers

Method test_lazy_handlers

tests/test_downloader_handlers.py:102–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

100 assert dh._get_handler("scheme") is None
101
102 def test_lazy_handlers(self):
103 handlers = {"scheme": DummyLazyDH}
104 crawler = get_crawler(settings_dict={"DOWNLOAD_HANDLERS": handlers})
105 with pytest.warns(
106 ScrapyDeprecationWarning,
107 match="DummyLazyDH doesn't define a 'lazy' attribute",
108 ):
109 dh = DownloadHandlers(crawler)
110 assert "scheme" in dh._schemes
111 assert "scheme" not in dh._handlers
112 handler = dh._get_handler("scheme") # force load lazy handler
113 assert handler
114 assert "scheme" in dh._handlers
115 assert "scheme" not in dh._notconfigured
116
117
118class TestFile:

Callers

nothing calls this directly

Calls 3

_get_handlerMethod · 0.95
get_crawlerFunction · 0.90
DownloadHandlersClass · 0.90

Tested by

no test coverage detected