Signed-off-by: IWAMOTO Toshihiro <[email protected]>
---
ryu/tests/unit/packet/test_bmp.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/ryu/tests/unit/packet/test_bmp.py
b/ryu/tests/unit/packet/test_bmp.py
index f943370..f93b801 100644
--- a/ryu/tests/unit/packet/test_bmp.py
+++ b/ryu/tests/unit/packet/test_bmp.py
@@ -34,6 +34,11 @@ class Test_bmp(unittest.TestCase):
def tearDown(self):
pass
+ def _time(self):
+ # time() can give sub-microsecond precision, which results
+ # in an assertion failure
+ return round(time(), 6)
+
def test_route_monitoring(self):
update = bgp.BGPUpdate()
msg = bmp.BMPRouteMonitoring(bgp_update=update,
@@ -43,7 +48,7 @@ class Test_bmp(unittest.TestCase):
peer_address='192.0.2.1',
peer_as=30000,
peer_bgp_id='192.0.2.1',
- timestamp=time())
+ timestamp=self._time())
binmsg = msg.serialize()
msg2, rest = bmp.BMPMessage.parser(binmsg)
eq_(msg.to_jsondict(), msg2.to_jsondict())
@@ -62,7 +67,7 @@ class Test_bmp(unittest.TestCase):
peer_address='192.0.2.1',
peer_as=30000,
peer_bgp_id='192.0.2.1',
- timestamp=time())
+ timestamp=self._time())
binmsg = msg.serialize()
msg2, rest = bmp.BMPMessage.parser(binmsg)
eq_(msg.to_jsondict(), msg2.to_jsondict())
@@ -79,7 +84,7 @@ class Test_bmp(unittest.TestCase):
peer_address='192.0.2.1',
peer_as=30000,
peer_bgp_id='192.0.2.1',
- timestamp=time())
+ timestamp=self._time())
binmsg = msg.serialize()
msg2, rest = bmp.BMPMessage.parser(binmsg)
eq_(msg.to_jsondict(), msg2.to_jsondict())
@@ -104,7 +109,7 @@ class Test_bmp(unittest.TestCase):
peer_address='192.0.2.1',
peer_as=30000,
peer_bgp_id='192.0.2.1',
- timestamp=time())
+ timestamp=self._time())
binmsg = msg.serialize()
msg2, rest = bmp.BMPMessage.parser(binmsg)
eq_(msg.to_jsondict(), msg2.to_jsondict())
--
2.1.4
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel