()
| 26 | |
| 27 | @pytest.mark.asyncio |
| 28 | async def test_concurrent_crawling_performance(): |
| 29 | async with AsyncWebCrawler(verbose=True) as crawler: |
| 30 | urls = [ |
| 31 | "https://www.nbcnews.com/business", |
| 32 | "https://www.example.com", |
| 33 | "https://www.python.org", |
| 34 | "https://www.github.com", |
| 35 | "https://www.stackoverflow.com" |
| 36 | ] |
| 37 | |
| 38 | start_time = time.time() |
| 39 | results = await crawler.arun_many(urls=urls, bypass_cache=True) |
| 40 | end_time = time.time() |
| 41 | |
| 42 | total_time = end_time - start_time |
| 43 | print(f"Total time for concurrent crawling: {total_time:.2f} seconds") |
| 44 | |
| 45 | assert all(result.success for result in results) |
| 46 | assert len(results) == len(urls) |
| 47 | |
| 48 | assert total_time < len(urls) * 5, f"Concurrent crawling not significantly faster: {total_time:.2f} seconds" |
| 49 | |
| 50 | @pytest.mark.asyncio |
| 51 | async def test_crawl_speed_with_caching(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…