From a304d6b692664f06c67fb23eb08fd985eda72e21 Mon Sep 17 00:00:00 2001 From: Daniel Grana Date: Wed, 15 Aug 2018 02:02:20 -0700 Subject: [PATCH] Workaround to pass tests/test_feedexporter.py under windows --- tests/test_feedexport.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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):