MCPcopy
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / test_lazy_load_exception

Function test_lazy_load_exception

tests/test_chromium.py:319–329  ·  view source on GitHub ↗

Test that lazy_load propagates exception if the scraping function fails.

(loader_with_dummy, monkeypatch)

Source from the content-addressed store, hash-verified

317
318@pytest.mark.asyncio
319async def test_lazy_load_exception(loader_with_dummy, monkeypatch):
320 """Test that lazy_load propagates exception if the scraping function fails."""
321
322 async def dummy_failure(url):
323 raise Exception("Dummy scraping error")
324
325 # Patch the scraping method to always raise an exception
326 loader_with_dummy.backend = "playwright"
327 monkeypatch.setattr(loader_with_dummy, "ascrape_playwright", dummy_failure)
328 with pytest.raises(Exception, match="Dummy scraping error"):
329 list(loader_with_dummy.lazy_load())
330
331
332@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 1

lazy_loadMethod · 0.45

Tested by

no test coverage detected