# HG changeset patch # User RĂ©mi Cardona # Date 1442850855 -7200 # Node ID e9abbaa835f5c82dde95df5a68245d2e32168687 # Parent 201028085e1264ba1d94a906fdfaee59d796ecdb [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. diff -r 201028085e12 -r e9abbaa835f5 test/unittest_cwctl.py --- 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__