From 9f5e84d4917b29fe6d7668f4742da8769b4ff515 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 27 Oct 2017 15:54:54 +0200 Subject: testutil: Fix logger warnings for py2 --- tests/testutil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/testutil.py b/tests/testutil.py index e02ea70..89feb3c 100644 --- a/tests/testutil.py +++ b/tests/testutil.py @@ -7,13 +7,17 @@ import io import logging import os import os.path +import sys import tempfile import unittest class LoggingTestCase(unittest.TestCase): def setUp(self): - self.log = io.StringIO() + if sys.version_info < (3,): + self.log = io.BytesIO() + else: + self.log = io.StringIO() self.log_handler = logging.getLogger().addHandler( logging.StreamHandler(self.log)) -- cgit v1.2.3