Closed Gallaecio closed 7 months ago
Some tests are hanging with the new API. I suspect it has to do not with the new API, but with making engine_started async. But I’m having a hard time figuring it out, so I’ll come back later with fresh eyes (if anyone wants to give it a go before that, be my guess).
It seems the issue was that open_spider
ended up being called before the engine started. And the engine_started
signal also fires before engine.running
is set to True
. So the earliest point I could think of to close the spider, which requires the engine to be running, was to wait until the first request processing.
Codecov Report
Additional details and impacted files
```diff @@ Coverage Diff @@ ## main #185 +/- ## ========================================== - Coverage 98.57% 97.14% -1.43% ========================================== Files 13 13 Lines 1052 1052 ========================================== - Hits 1037 1022 -15 - Misses 15 30 +15 ``` | [Files](https://app.codecov.io/gh/scrapy-plugins/scrapy-zyte-api/pull/185?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy-plugins) | Coverage Δ | | |---|---|---| | [scrapy\_zyte\_api/handler.py](https://app.codecov.io/gh/scrapy-plugins/scrapy-zyte-api/pull/185?src=pr&el=tree&filepath=scrapy_zyte_api%2Fhandler.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy-plugins#diff-c2NyYXB5X3p5dGVfYXBpL2hhbmRsZXIucHk=) | `98.26% <100.00%> (ø)` | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/scrapy-plugins/scrapy-zyte-api/pull/185/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy-plugins)