Skip to content

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

Workaround to pass tests/test_feedexporter.py under windows

Daniel Granaa304d6b69266
diff --git a/tests/test_feedexport.py b/tests/test_feedexport.py
index 6eefa14bf..76452d450 100644
--- a/tests/test_feedexport.py
+++ b/tests/test_feedexport.py
@@ -241,10 +241,18 @@ class FeedExportTest(unittest.TestCase):
yield runner.crawl(spider_cls)
with open(res_path, 'rb') as f:
- defer.returnValue(f.read())
+ content = f.read()
finally:
- shutil.rmtree(tmpdir)
+ # FIXME: Windows fails to remove the file because FeedExporter
+ # keeps a reference to the temporal file even after
+ # the spider finished.
+ try:
+ shutil.rmtree(tmpdir)
+ except OSError:
+ pass
+
+ defer.returnValue(content)
@defer.inlineCallbacks
def exported_data(self, items, settings):