Scrapy, a fast high-level web crawling & scraping framework for Python.
Fix FTPTestCase by using Windows-friendly temporary file name
Jakob de Maeyer152fde70b12f
diff --git a/tests/test_downloader_handlers.py b/tests/test_downloader_handlers.pyindex c91be2c0c..fe76989f4 100644--- a/tests/test_downloader_handlers.py+++ b/tests/test_downloader_handlers.py@@ -1,7 +1,8 @@import osimport six-import contextlibimport shutil+import tempfile+import contextlibtry:from unittest import mockexcept ImportError:@@ -913,7 +914,8 @@ class BaseFTPTestCase(unittest.TestCase):return self._add_test_callbacks(d, _test)def test_ftp_local_filename(self):- local_fname = b"/tmp/file.txt"+ f, local_fname = tempfile.mkstemp()+ os.close(f)meta = {"ftp_local_filename": local_fname}meta.update(self.req_meta)request = Request(url="ftp://127.0.0.1:%s/file.txt" % self.portNum,@@ -922,7 +924,8 @@ class BaseFTPTestCase(unittest.TestCase):def _test(r):self.assertEqual(r.body, local_fname)- self.assertEqual(r.headers, {b'Local Filename': [b'/tmp/file.txt'], b'Size': [b'17']})+ self.assertEqual(r.headers, {b'Local Filename': [local_fname],+ b'Size': [b'17']})self.assertTrue(os.path.exists(local_fname))with open(local_fname, "rb") as f:self.assertEqual(f.read(), b"I have the power!")