Workaround to pass tests/test_feedexporter.py under windows

This commit is contained in:
Daniel Grana 2018-08-15 02:02:20 -07:00
parent e7fe243c3e
commit a304d6b692
1 changed files with 10 additions and 2 deletions

View File

@ -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):