tox: Adapt to PyPy interpreter
Note: Though tests may not be enough, as far as running unit test, this patch makes compatible with PyPy interpreter. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
4dc709d90d
commit
2ae4f884ab
@ -6,6 +6,7 @@ env:
|
||||
- TOX_ENV=py26
|
||||
- TOX_ENV=py27
|
||||
- TOX_ENV=py34
|
||||
- TOX_ENV=pypy
|
||||
- TOX_ENV=pep8
|
||||
|
||||
install:
|
||||
|
@ -787,7 +787,7 @@ def get_meter_features(dp, waiters):
|
||||
if (1 << k) & feature.band_types:
|
||||
band_types.append(v)
|
||||
capabilities = []
|
||||
for k, v in capa_convert.items():
|
||||
for k, v in sorted(capa_convert.items()):
|
||||
if k & feature.capabilities:
|
||||
capabilities.append(v)
|
||||
f = {'max_meter': feature.max_meter,
|
||||
@ -829,7 +829,7 @@ def get_meter_config(dp, waiters):
|
||||
b['experimenter'] = band.experimenter
|
||||
bands.append(b)
|
||||
c_flags = []
|
||||
for k, v in flags.items():
|
||||
for k, v in sorted(flags.items()):
|
||||
if k & config.flags:
|
||||
c_flags.append(v)
|
||||
c = {'flags': c_flags,
|
||||
|
@ -682,7 +682,7 @@ class OSPFMessage(packet_base.PacketBase, _TypeDisp):
|
||||
rest = buf[length:]
|
||||
subcls = cls._lookup_type(type_)
|
||||
kwargs = subcls.parser(binmsg)
|
||||
return subcls(length, router_id, area_id, au_type, authentication,
|
||||
return subcls(length, router_id, area_id, au_type, int(authentication),
|
||||
checksum, version, **kwargs), None, rest
|
||||
|
||||
@classmethod
|
||||
|
@ -9,9 +9,9 @@
|
||||
}
|
||||
],
|
||||
"flags": [
|
||||
"STATS",
|
||||
"PKTPS",
|
||||
"BURST"
|
||||
"BURST",
|
||||
"STATS"
|
||||
],
|
||||
"meter_id": 100
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
"DSCP_REMARK"
|
||||
],
|
||||
"capabilities": [
|
||||
"STATS",
|
||||
"KBPS",
|
||||
"PKTPS",
|
||||
"BURST"
|
||||
"BURST",
|
||||
"STATS"
|
||||
],
|
||||
"max_bands": 255,
|
||||
"max_color": 0,
|
||||
|
@ -73,7 +73,8 @@ class Test_ofctl(unittest.TestCase):
|
||||
# expected message <--> sent message
|
||||
request.serialize()
|
||||
try:
|
||||
eq_(request.to_jsondict(), dp.request_msg.to_jsondict())
|
||||
eq_(json.dumps(request.to_jsondict(), sort_keys=True),
|
||||
json.dumps(dp.request_msg.to_jsondict(), sort_keys=True))
|
||||
except AssertionError as e:
|
||||
# For debugging
|
||||
json.dump(dp.request_msg.to_jsondict(),
|
||||
@ -95,9 +96,11 @@ class Test_ofctl(unittest.TestCase):
|
||||
return d2
|
||||
return d
|
||||
|
||||
expected = _remove(expected, ['len', 'length'])
|
||||
output = _remove(output, ['len', 'length'])
|
||||
try:
|
||||
eq_(_remove(expected, ['len', 'length']),
|
||||
_remove(output, ['len', 'length']))
|
||||
eq_(json.dumps(expected, sort_keys=True),
|
||||
json.dumps(output, sort_keys=True))
|
||||
except AssertionError as e:
|
||||
# For debugging
|
||||
json.dump(output, open('/tmp/' + name + '_reply.json', 'w'),
|
||||
|
@ -119,7 +119,13 @@ class Test_rpc(unittest.TestCase):
|
||||
assert isinstance(obj, int)
|
||||
result = c.call(b'resp', [obj])
|
||||
assert result == obj
|
||||
assert isinstance(result, type(obj))
|
||||
import sys
|
||||
# note: on PyPy, result will be a long type value.
|
||||
sv = getattr(sys, 'subversion', None)
|
||||
if sv is not None and sv[0] == 'PyPy':
|
||||
assert isinstance(result, long)
|
||||
else:
|
||||
assert isinstance(result, type(obj))
|
||||
|
||||
def test_0_call_int3(self):
|
||||
c = rpc.Client(self._client_sock)
|
||||
@ -237,6 +243,11 @@ class Test_rpc(unittest.TestCase):
|
||||
@unittest.skip("doesn't work with eventlet 0.18 and later")
|
||||
def test_4_call_large_binary(self):
|
||||
import struct
|
||||
import sys
|
||||
# note: on PyPy, this test case may hang up.
|
||||
sv = getattr(sys, 'subversion', None)
|
||||
if sv is not None and sv[0] == 'PyPy':
|
||||
return
|
||||
|
||||
c = rpc.Client(self._client_sock)
|
||||
obj = struct.pack("10000000x")
|
||||
|
@ -4,5 +4,6 @@ nose
|
||||
pep8
|
||||
pylint==0.25.0
|
||||
formencode
|
||||
lxml # OF-Config
|
||||
lxml; platform_python_implementation != 'PyPy' # OF-Config
|
||||
lxml==3.4.0; platform_python_implementation == 'PyPy'
|
||||
paramiko # NETCONF, BGP speaker
|
||||
|
Loading…
x
Reference in New Issue
Block a user