Get rid of py26 references: OrderedDict, httplib, xml testing
Change-Id: I44315e0663a7c0c82110b933b68e2b747f548859
This commit is contained in:
parent
208ebafb1d
commit
c5310e05ae
@ -637,13 +637,8 @@ class HTTPSConnectionWithValidation(httplib.HTTPSConnection):
|
||||
combined_cert = None
|
||||
|
||||
def connect(self):
|
||||
try:
|
||||
sock = socket.create_connection((self.host, self.port),
|
||||
self.timeout, self.source_address)
|
||||
except AttributeError:
|
||||
# python 2.6 doesn't have the source_address attribute
|
||||
sock = socket.create_connection((self.host, self.port),
|
||||
self.timeout)
|
||||
if self._tunnel_host:
|
||||
self.sock = sock
|
||||
self._tunnel()
|
||||
|
@ -25,7 +25,6 @@ errors due to duplicate configuration definitions.
|
||||
|
||||
import logging as std_logging
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
@ -97,10 +96,6 @@ class BaseTestCase(sub_base.SubBaseTestCase):
|
||||
fake_use_fatal_exceptions))
|
||||
|
||||
self.setup_rpc_mocks()
|
||||
|
||||
if sys.version_info < (2, 7) and getattr(self, 'fmt', '') == 'xml':
|
||||
raise self.skipException('XML Testing Skipped in Py26')
|
||||
|
||||
self.setup_config()
|
||||
|
||||
def setup_rpc_mocks(self):
|
||||
|
@ -26,11 +26,6 @@ from neutron.plugins.common import constants
|
||||
from neutron.tests import base
|
||||
from neutron.tests import tools
|
||||
|
||||
try:
|
||||
OrderedDict = collections.OrderedDict
|
||||
except AttributeError:
|
||||
import ordereddict
|
||||
OrderedDict = ordereddict.OrderedDict
|
||||
|
||||
OVS_LINUX_KERN_VERS_WITHOUT_VXLAN = "3.12.0"
|
||||
|
||||
@ -244,26 +239,30 @@ class OVS_Lib_Test(base.BaseTestCase):
|
||||
lsw_id = 18
|
||||
cidr = '192.168.1.0/24'
|
||||
|
||||
flow_dict_1 = OrderedDict([('priority', 2),
|
||||
flow_dict_1 = collections.OrderedDict([
|
||||
('priority', 2),
|
||||
('dl_src', 'ca:fe:de:ad:be:ef'),
|
||||
('actions', 'strip_vlan,output:0')])
|
||||
flow_dict_2 = OrderedDict([('priority', 1),
|
||||
flow_dict_2 = collections.OrderedDict([
|
||||
('priority', 1),
|
||||
('actions', 'normal')])
|
||||
flow_dict_3 = OrderedDict([('priority', 2),
|
||||
flow_dict_3 = collections.OrderedDict([
|
||||
('priority', 2),
|
||||
('actions', 'drop')])
|
||||
flow_dict_4 = OrderedDict([('priority', 2),
|
||||
flow_dict_4 = collections.OrderedDict([
|
||||
('priority', 2),
|
||||
('in_port', ofport),
|
||||
('actions', 'drop')])
|
||||
flow_dict_5 = OrderedDict([
|
||||
flow_dict_5 = collections.OrderedDict([
|
||||
('priority', 4),
|
||||
('in_port', ofport),
|
||||
('dl_vlan', vid),
|
||||
('actions', "strip_vlan,set_tunnel:%s,normal" % (lsw_id))])
|
||||
flow_dict_6 = OrderedDict([
|
||||
flow_dict_6 = collections.OrderedDict([
|
||||
('priority', 3),
|
||||
('tun_id', lsw_id),
|
||||
('actions', "mod_vlan_vid:%s,output:%s" % (vid, ofport))])
|
||||
flow_dict_7 = OrderedDict([
|
||||
flow_dict_7 = collections.OrderedDict([
|
||||
('priority', 4),
|
||||
('nw_src', cidr),
|
||||
('proto', 'arp'),
|
||||
@ -320,7 +319,8 @@ class OVS_Lib_Test(base.BaseTestCase):
|
||||
self.execute.assert_has_calls(expected_calls)
|
||||
|
||||
def test_add_flow_timeout_set(self):
|
||||
flow_dict = OrderedDict([('priority', 1),
|
||||
flow_dict = collections.OrderedDict([
|
||||
('priority', 1),
|
||||
('hard_timeout', 1000),
|
||||
('idle_timeout', 2000),
|
||||
('actions', 'normal')])
|
||||
@ -333,7 +333,7 @@ class OVS_Lib_Test(base.BaseTestCase):
|
||||
root_helper=self.root_helper)
|
||||
|
||||
def test_add_flow_default_priority(self):
|
||||
flow_dict = OrderedDict([('actions', 'normal')])
|
||||
flow_dict = collections.OrderedDict([('actions', 'normal')])
|
||||
|
||||
self.br.add_flow(**flow_dict)
|
||||
self.execute.assert_called_once_with(
|
||||
|
@ -512,9 +512,6 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
||||
con = self.sm.HTTPSConnectionWithValidation(
|
||||
'www.example.org', 443, timeout=90)
|
||||
con.source_address = '127.0.0.1'
|
||||
if not hasattr(con, 'set_tunnel'):
|
||||
# no tunnel support in py26
|
||||
return
|
||||
con.set_tunnel('myproxy.local', 3128)
|
||||
con.request("GET", "/")
|
||||
self.socket_mock.assert_has_calls([mock.call(
|
||||
|
@ -39,12 +39,6 @@ from neutron import manager
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit import test_extension_security_group as test_sg
|
||||
|
||||
try:
|
||||
OrderedDict = collections.OrderedDict
|
||||
except AttributeError:
|
||||
import ordereddict
|
||||
OrderedDict = ordereddict.OrderedDict
|
||||
|
||||
FAKE_PREFIX = {const.IPv4: '10.0.0.0/24',
|
||||
const.IPv6: '2001:db8::/64'}
|
||||
FAKE_IP = {const.IPv4: '10.0.0.1',
|
||||
@ -1210,8 +1204,7 @@ class SecurityGroupAgentEnhancedRpcTestCase(
|
||||
super(SecurityGroupAgentEnhancedRpcTestCase, self).setUp(
|
||||
defer_refresh_firewall=defer_refresh_firewall)
|
||||
fake_sg_info = {
|
||||
'security_groups':
|
||||
OrderedDict([
|
||||
'security_groups': collections.OrderedDict([
|
||||
('fake_sgid2', []),
|
||||
('fake_sgid1', [{'remote_group_id': 'fake_sgid2'}])]),
|
||||
'sg_member_ips': {'fake_sgid2': {'IPv4': [], 'IPv6': []}},
|
||||
|
@ -9,7 +9,6 @@ discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
python-subunit>=0.0.18
|
||||
ordereddict
|
||||
requests-mock>=0.5.1 # Apache-2.0
|
||||
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||
oslosphinx>=2.2.0 # Apache-2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user