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

Function test_alazy_load_partial_failure

tests/test_chromium.py:351–364  ·  view source on GitHub ↗

Test that alazy_load propagates an exception if one of the scraping tasks fails.

(monkeypatch)

Source from the content-addressed store, hash-verified

349
350@pytest.mark.asyncio
351async def test_alazy_load_partial_failure(monkeypatch):
352 """Test that alazy_load propagates an exception if one of the scraping tasks fails."""
353 urls = ["http://example.com", "http://fail.com"]
354 loader = ChromiumLoader(urls, backend="playwright")
355
356 async def partial_scraper(url):
357 if "fail" in url:
358 raise Exception("Scraping failed for " + url)
359 return f"<html>Content for {url}</html>"
360
361 monkeypatch.setattr(loader, "ascrape_playwright", partial_scraper)
362
363 with pytest.raises(Exception, match="Scraping failed for http://fail.com"):
364 [doc async for doc in loader.alazy_load()]
365
366
367@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

alazy_loadMethod · 0.95
ChromiumLoaderClass · 0.90

Tested by

no test coverage detected