[tests] Port unittest_cwctl to py3k
On python 2, sys.stdout takes bytes-like objects whereas python 3's
takes unicode-like objects and handles the encoding on its own.
--- a/test/unittest_cwctl.py Mon Sep 21 17:51:58 2015 +0200
+++ b/test/unittest_cwctl.py Mon Sep 21 17:54:15 2015 +0200
@@ -18,7 +18,10 @@
import sys
import os
from os.path import join
-from cStringIO import StringIO
+from io import StringIO, BytesIO
+
+from six import PY2
+
from logilab.common.testlib import TestCase, unittest_main
from cubicweb.cwconfig import CubicWebConfiguration
@@ -30,7 +33,7 @@
class CubicWebCtlTC(TestCase):
def setUp(self):
- self.stream = StringIO()
+ self.stream = BytesIO() if PY2 else StringIO()
sys.stdout = self.stream
def tearDown(self):
sys.stdout = sys.__stdout__