From d2589c74c59603af1c67f6f5416cc6a8c67dd421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Tue, 1 Mar 2022 15:50:19 +0100 Subject: [PATCH] =?UTF-8?q?test=5Funbounded=5Fresponse:=20to=5Funicode=20?= =?UTF-8?q?=E2=86=92=20custom=20six=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_crawl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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):