Scrapy, a fast high-level web crawling & scraping framework for Python.
py3: body to bytes in tests, unskip test file
Konstantin Lopuhin94ab7bee6c56
diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txtindex 57e80f590..0da1b6089 100644--- a/tests/py3-ignores.txt+++ b/tests/py3-ignores.txt@@ -7,7 +7,6 @@ tests/test_crawl.pytests/test_downloadermiddleware_httpcache.pytests/test_downloadermiddleware_httpcompression.pytests/test_downloadermiddleware_httpproxy.py-tests/test_downloadermiddleware.pytests/test_downloadermiddleware_retry.pytests/test_engine.pytests/test_mail.pydiff --git a/tests/test_downloadermiddleware.py b/tests/test_downloadermiddleware.pyindex 13f35b92a..fb51392b2 100644--- a/tests/test_downloadermiddleware.py+++ b/tests/test_downloadermiddleware.py@@ -5,6 +5,7 @@ from scrapy.http import Request, Responsefrom scrapy.spiders import Spiderfrom scrapy.core.downloader.middleware import DownloaderMiddlewareManagerfrom scrapy.utils.test import get_crawler+from scrapy.utils.python import to_bytesfrom tests import mock@@ -68,7 +69,7 @@ class DefaultsTest(ManagerTestCase):"""req = Request('http://example.com')- body = '<p>You are being redirected</p>'+ body = b'<p>You are being redirected</p>'resp = Response(req.url, status=302, body=body, headers={'Content-Length': str(len(body)),'Content-Type': 'text/html',@@ -78,12 +79,12 @@ class DefaultsTest(ManagerTestCase):ret = self._download(request=req, response=resp)self.assertTrue(isinstance(ret, Request),"Not redirected: {0!r}".format(ret))- self.assertEqual(ret.url, resp.headers['Location'],+ self.assertEqual(to_bytes(ret.url), resp.headers['Location'],"Not redirected to location header")def test_200_and_invalid_gzipped_body_must_fail(self):req = Request('http://example.com')- body = '<p>You are being redirected</p>'+ body = b'<p>You are being redirected</p>'resp = Response(req.url, status=200, body=body, headers={'Content-Length': str(len(body)),'Content-Type': 'text/html',