Merge "Use six.StringIO/BytesIO instead of StringIO.StringIO"
This commit is contained in:
commit
d684f750a5
@ -21,7 +21,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
import StringIO
|
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -413,7 +412,7 @@ class Dnsmasq(DhcpLocalProcess):
|
|||||||
def _output_hosts_file(self):
|
def _output_hosts_file(self):
|
||||||
"""Writes a dnsmasq compatible hosts file."""
|
"""Writes a dnsmasq compatible hosts file."""
|
||||||
r = re.compile('[:.]')
|
r = re.compile('[:.]')
|
||||||
buf = StringIO.StringIO()
|
buf = six.StringIO()
|
||||||
|
|
||||||
for port in self.network.ports:
|
for port in self.network.ports:
|
||||||
for alloc in port.fixed_ips:
|
for alloc in port.fixed_ips:
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
"""Test of Policy Engine For Neutron"""
|
"""Test of Policy Engine For Neutron"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import StringIO
|
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
import neutron
|
import neutron
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
@ -120,7 +120,7 @@ class PolicyTestCase(base.BaseTestCase):
|
|||||||
def test_enforce_http_true(self):
|
def test_enforce_http_true(self):
|
||||||
|
|
||||||
def fakeurlopen(url, post_data):
|
def fakeurlopen(url, post_data):
|
||||||
return StringIO.StringIO("True")
|
return six.StringIO("True")
|
||||||
|
|
||||||
with mock.patch.object(urllib2, 'urlopen', new=fakeurlopen):
|
with mock.patch.object(urllib2, 'urlopen', new=fakeurlopen):
|
||||||
action = "example:get_http"
|
action = "example:get_http"
|
||||||
@ -131,7 +131,7 @@ class PolicyTestCase(base.BaseTestCase):
|
|||||||
def test_enforce_http_false(self):
|
def test_enforce_http_false(self):
|
||||||
|
|
||||||
def fakeurlopen(url, post_data):
|
def fakeurlopen(url, post_data):
|
||||||
return StringIO.StringIO("False")
|
return six.StringIO("False")
|
||||||
|
|
||||||
with mock.patch.object(urllib2, 'urlopen', new=fakeurlopen):
|
with mock.patch.object(urllib2, 'urlopen', new=fakeurlopen):
|
||||||
action = "example:get_http"
|
action = "example:get_http"
|
||||||
|
Loading…
Reference in New Issue
Block a user