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:
parent
9a7f2f8543
commit
750247a9da
|
@ -17,11 +17,11 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
import StringIO
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# needed to get greenthreads
|
# needed to get greenthreads
|
||||||
import greenlet
|
import greenlet
|
||||||
|
import six
|
||||||
|
|
||||||
from openstack.common.report import guru_meditation_report as gmr
|
from openstack.common.report import guru_meditation_report as gmr
|
||||||
from openstack.common.report.models import with_default_views as mwdv
|
from openstack.common.report.models import with_default_views as mwdv
|
||||||
|
@ -143,7 +143,7 @@ class TestGuruMeditationReport(utils.BaseTestCase):
|
||||||
def test_register_autorun(self):
|
def test_register_autorun(self):
|
||||||
gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
|
gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
|
||||||
self.old_stderr = sys.stderr
|
self.old_stderr = sys.stderr
|
||||||
sys.stderr = StringIO.StringIO()
|
sys.stderr = six.StringIO()
|
||||||
|
|
||||||
os.kill(os.getpid(), signal.SIGUSR1)
|
os.kill(os.getpid(), signal.SIGUSR1)
|
||||||
self.assertIn('Guru Meditation', sys.stderr.getvalue())
|
self.assertIn('Guru Meditation', sys.stderr.getvalue())
|
||||||
|
|
Loading…
Reference in New Issue