Skip to content

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

Fix FileFeedStoragePreFeedOptionsTest fails in CI/CD pipeline (#5198)

Mannan281294baa4b27273
diff --git a/tests/test_feedexport.py b/tests/test_feedexport.py
index 389808306..53e6a2018 100644
--- a/tests/test_feedexport.py
+++ b/tests/test_feedexport.py
@@ -1932,14 +1932,15 @@ class FileFeedStoragePreFeedOptionsTest(unittest.TestCase):
maxDiff = None
def test_init(self):
- settings_dict = {
- 'FEED_URI': 'file:///tmp/foobar',
- 'FEED_STORAGES': {
- 'file': FileFeedStorageWithoutFeedOptions
- },
- }
- crawler = get_crawler(settings_dict=settings_dict)
- feed_exporter = FeedExporter.from_crawler(crawler)
+ with tempfile.NamedTemporaryFile() as temp:
+ settings_dict = {
+ 'FEED_URI': f'file:///{temp.name}',
+ 'FEED_STORAGES': {
+ 'file': FileFeedStorageWithoutFeedOptions
+ },
+ }
+ crawler = get_crawler(settings_dict=settings_dict)
+ feed_exporter = FeedExporter.from_crawler(crawler)
spider = scrapy.Spider("default")
with warnings.catch_warnings(record=True) as w:
feed_exporter.open_spider(spider)