Skip to content

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

PY3 port test_logformatter

Mikhail Korobov68a47ade46e6
diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txt
index 4d7fdc430..f380e6679 100644
--- a/tests/py3-ignores.txt
+++ b/tests/py3-ignores.txt
@@ -20,7 +20,6 @@ tests/test_downloadermiddleware_retry.py
tests/test_downloadermiddleware_stats.py
tests/test_downloadermiddleware_useragent.py
tests/test_engine.py
-tests/test_logformatter.py
tests/test_mail.py
tests/test_pipeline_files.py
tests/test_pipeline_images.py
diff --git a/tests/test_logformatter.py b/tests/test_logformatter.py
index ec42ef8ab..50e9662c6 100644
--- a/tests/test_logformatter.py
+++ b/tests/test_logformatter.py
@@ -1,4 +1,5 @@
import unittest
+import six
from scrapy.spiders import Spider
from scrapy.http import Request, Response
@@ -42,7 +43,7 @@ class LoggingContribTest(unittest.TestCase):
logkws = self.formatter.dropped(item, exception, response, self.spider)
logline = logkws['msg'] % logkws['args']
lines = logline.splitlines()
- assert all(isinstance(x, unicode) for x in lines)
+ assert all(isinstance(x, six.text_type) for x in lines)
self.assertEqual(lines, [u"Dropped: \u2018", '{}'])
def test_scraped(self):
@@ -52,7 +53,7 @@ class LoggingContribTest(unittest.TestCase):
logkws = self.formatter.scraped(item, response, self.spider)
logline = logkws['msg'] % logkws['args']
lines = logline.splitlines()
- assert all(isinstance(x, unicode) for x in lines)
+ assert all(isinstance(x, six.text_type) for x in lines)
self.assertEqual(lines, [u"Scraped from <200 http://www.example.com>", u'name: \xa3'])
if __name__ == "__main__":