Fix TestEngineDownloadAsync.engine.

This commit is contained in:
Andrey Rakhmatullin 2026-07-15 00:45:59 +05:00
parent 46f56b3f09
commit 189798c78a
1 changed files with 11 additions and 11 deletions

View File

@ -13,20 +13,20 @@ from scrapy.utils.test import get_crawler
from tests.utils.decorators import coroutine_test
@pytest.fixture
def engine() -> ExecutionEngine:
crawler = get_crawler(DefaultSpider)
engine = ExecutionEngine(crawler, lambda _: None)
engine.downloader.close()
engine.downloader = Mock()
engine._slot = Mock()
engine._slot.inprogress = set()
return engine
class TestEngineDownloadAsync:
"""Test cases for ExecutionEngine.download_async()."""
@pytest.fixture
def engine(self) -> ExecutionEngine:
# crawler = get_crawler(MySpider)
crawler = get_crawler(DefaultSpider)
engine = ExecutionEngine(crawler, lambda _: None)
engine.downloader.close()
engine.downloader = Mock()
engine._slot = Mock()
engine._slot.inprogress = set()
return engine
@staticmethod
async def _download(engine: ExecutionEngine, request: Request) -> Response:
return await engine.download_async(request)