Use six.StringIO/BytesIO instead of StringIO.StringIO

to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO

StringIO works for unicode
BytesIO works for bytes

Change-Id: Id7f4c3f701275229714f45296eac9f7f34ff6ece
Partial-Bug: #1280100
This commit is contained in:
tanlin 2014-02-19 11:09:29 +08:00
parent 9a7f2f8543
commit 750247a9da
1 changed files with 2 additions and 2 deletions

View File

@ -17,11 +17,11 @@ from __future__ import print_function
import os
import re
import signal
import StringIO
import sys
# needed to get greenthreads
import greenlet
import six
from openstack.common.report import guru_meditation_report as gmr
from openstack.common.report.models import with_default_views as mwdv
@ -143,7 +143,7 @@ class TestGuruMeditationReport(utils.BaseTestCase):
def test_register_autorun(self):
gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
self.old_stderr = sys.stderr
sys.stderr = StringIO.StringIO()
sys.stderr = six.StringIO()
os.kill(os.getpid(), signal.SIGUSR1)
self.assertIn('Guru Meditation', sys.stderr.getvalue())