diff --git a/tests/test_crawl.py b/tests/test_crawl.py index 5b0550f1a..cdc074654 100644 --- a/tests/test_crawl.py +++ b/tests/test_crawl.py @@ -1,6 +1,7 @@ import json import logging +import six from testfixtures import LogCapture from twisted.internet import defer from twisted.trial.unittest import TestCase @@ -161,7 +162,11 @@ with multiples lines crawler = self.runner.create_crawler(SimpleSpider) with LogCapture() as l: yield crawler.crawl(self.mockserver.url("/raw?{0}".format(query)), mockserver=self.mockserver) - self.assertEqual(to_unicode(l).count("Got response 200"), 1) + if six.PY2: + message = unicode(l) + else: + message = str(l) + self.assertEqual(message.count("Got response 200"), 1) @defer.inlineCallbacks def test_retry_conn_lost(self):