[dts] [PATCH V1 3/3] tests: fix the statement errors that not supported by python3

xinfengx xinfengx.zhao at intel.com
Wed Jan 15 23:33:00 CET 2020


Signed-off-by: xinfengx <xinfengx.zhao at intel.com>
---
 tests/TestSuite_eventdev_pipeline.py | 5 ++++-
 tests/TestSuite_telemetry.py         | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_eventdev_pipeline.py b/tests/TestSuite_eventdev_pipeline.py
index 29a42be..4818fc4 100644
--- a/tests/TestSuite_eventdev_pipeline.py
+++ b/tests/TestSuite_eventdev_pipeline.py
@@ -198,7 +198,10 @@ class TestEventdevPipeline(TestCase):
                     if packet_index == 0:
                         packet_index = int(self.pkts[i]['Raw'].load[-2:])
                         pay_load = "0000%.2d" % (packet_index)
-                    self.verify(self.pkts[i]['Raw'].load == pay_load,
+                    rev_pkt_load = self.pkts[i]['Raw'].load
+                    if isinstance(self.pkts[i]['Raw'].load, bytes):
+                        rev_pkt_load = str(self.pkts[i]['Raw'].load, encoding='utf-8')
+                    self.verify(rev_pkt_load == pay_load,
                             "%s : The packets not ordered" % case_info)
                     packet_index = packet_index + 1
 
diff --git a/tests/TestSuite_telemetry.py b/tests/TestSuite_telemetry.py
index e8ef6b7..000963b 100644
--- a/tests/TestSuite_telemetry.py
+++ b/tests/TestSuite_telemetry.py
@@ -405,7 +405,7 @@ class TestTelemetry(TestCase):
                 pformat(metric_missed_paras), ])
             error_msg.append(msg)
         # check if metric parameters and values are the same
-        if cmp(metric, xstat) != 0:
+        if metric != xstat:
             msg = 'telemetry metric data is not the same as testpmd xstat data'
             error_msg.append(msg)
             msg_fmt = 'port {} <{}>: metric is <{}>, xstat is is <{}>'.format
-- 
2.17.1



More information about the dts mailing list