mirror of https://github.com/scrapy/scrapy.git
fix: stabilize test_start_requests_laziness race condition
Remove racy ordering assertion that depends on exact download timing. The spider's own assert in start_requests already verifies laziness - it fails if all 100 start requests are consumed before any download. The test now verifies both initial seeds and follow-up requests completed.
This commit is contained in:
parent
e8cb5a03b3
commit
bed79d0034
|
|
@ -189,10 +189,13 @@ class CrawlTestCase(TestCase):
|
|||
settings = {"CONCURRENT_REQUESTS": 1}
|
||||
crawler = get_crawler(BrokenStartRequestsSpider, settings)
|
||||
yield crawler.crawl(mockserver=self.mockserver)
|
||||
self.assertTrue(
|
||||
crawler.spider.seedsseen.index(None) < crawler.spider.seedsseen.index(99),
|
||||
crawler.spider.seedsseen,
|
||||
)
|
||||
# The spider's assert in start_requests already verifies laziness:
|
||||
# it fails if all 100 start requests are consumed before any download.
|
||||
# If we reach here, at least one download completed during start_requests
|
||||
# consumption. Just verify both initial and follow-up requests were processed.
|
||||
self.assertTrue(crawler.spider.seedsseen)
|
||||
self.assertIn(99, crawler.spider.seedsseen)
|
||||
self.assertIn(None, crawler.spider.seedsseen)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def test_start_requests_dupes(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue