mirror of https://github.com/scrapy/scrapy.git
Close the file in test_stats_file_failed().
This commit is contained in:
parent
a7a3ef39ba
commit
0d9147ea85
|
|
@ -478,9 +478,14 @@ class TestFeedExport(TestFeedExportBase):
|
|||
},
|
||||
}
|
||||
crawler = get_crawler(ItemSpider, settings)
|
||||
|
||||
def store(file: IO[bytes]) -> None:
|
||||
file.close()
|
||||
raise KeyError("foo")
|
||||
|
||||
with mock.patch(
|
||||
"scrapy.extensions.feedexport.FileFeedStorage.store",
|
||||
side_effect=KeyError("foo"), # TODO this needs file.close()
|
||||
side_effect=store,
|
||||
):
|
||||
yield crawler.crawl(mockserver=self.mockserver)
|
||||
assert "feedexport/failed_count/FileFeedStorage" in crawler.stats.get_stats()
|
||||
|
|
|
|||
Loading…
Reference in New Issue