Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Don't use a HTTP request in a case that will not be awaited.

Andrey Rakhmatulline5b057cfd447
diff --git a/tests/test_utils_asyncgen.py b/tests/test_utils_asyncgen.py
index 41993a934..d9e6bc2eb 100644
--- a/tests/test_utils_asyncgen.py
+++ b/tests/test_utils_asyncgen.py
@@ -1,3 +1,4 @@
+from twisted.internet.defer import Deferred
from twisted.trial import unittest
from scrapy.utils.asyncgen import as_async_generator, collect_asyncgen, _process_iterable_universal
@@ -31,7 +32,10 @@ async def process_iterable(iterable):
async def process_iterable_awaiting(iterable):
async for i in iterable:
yield i * 2
- await get_web_client_agent_req('http://example.com')
+ d = Deferred()
+ from twisted.internet import reactor
+ reactor.callLater(0, d.callback, 42)
+ await d
class ProcessIterableUniversalTest(unittest.TestCase):