Browse Source

Use six.StringIO instead of StringIO.StringIO

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

Change-Id: I797b5b753a76481fad74a51e4e6973e64e9ef2a3
Closes-Bug: #1280100
Ji-Wei 2 years ago
parent
commit
d28851317c
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      dhcp_checker/tests/unit/test_utils.py

+ 3
- 2
dhcp_checker/tests/unit/test_utils.py View File

@@ -15,7 +15,6 @@
15 15
 #    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 16
 
17 17
 import os
18
-import StringIO
19 18
 
20 19
 from mock import call
21 20
 from mock import patch
@@ -24,6 +23,8 @@ import unittest
24 23
 
25 24
 from scapy import all as scapy
26 25
 
26
+from six import StringIO
27
+
27 28
 from dhcp_checker import utils
28 29
 
29 30
 IP_LINK_SHOW_UP = (
@@ -179,7 +180,7 @@ class TestIfaceStateHelper(unittest.TestCase):
179 180
         iface_value = iter(('DOWN',) * 10)
180 181
         iface_state.side_effect = lambda *args, **kwargs: next(iface_value)
181 182
 
182
-        with patch('sys.stderr', new=StringIO.StringIO()) as stderr_mock:
183
+        with patch('sys.stderr', new=StringIO()) as stderr_mock:
183 184
             with utils.IfaceState(['eth1'], wait_up=5) as ifaces:
184 185
                 self.assertEqual(ifaces[0], 'eth1')
185 186
 

Loading…
Cancel
Save