Browse Source

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
tags/2014.1.b3
tanlin 5 years ago
parent
commit
750247a9da
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      tests/unit/reports/test_guru_meditation_report.py

+ 2
- 2
tests/unit/reports/test_guru_meditation_report.py View File

@@ -17,11 +17,11 @@ from __future__ import print_function
17 17
 import os
18 18
 import re
19 19
 import signal
20
-import StringIO
21 20
 import sys
22 21
 
23 22
 # needed to get greenthreads
24 23
 import greenlet
24
+import six
25 25
 
26 26
 from openstack.common.report import guru_meditation_report as gmr
27 27
 from openstack.common.report.models import with_default_views as mwdv
@@ -143,7 +143,7 @@ class TestGuruMeditationReport(utils.BaseTestCase):
143 143
     def test_register_autorun(self):
144 144
         gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
145 145
         self.old_stderr = sys.stderr
146
-        sys.stderr = StringIO.StringIO()
146
+        sys.stderr = six.StringIO()
147 147
 
148 148
         os.kill(os.getpid(), signal.SIGUSR1)
149 149
         self.assertIn('Guru Meditation', sys.stderr.getvalue())

Loading…
Cancel
Save