Regression: fixes for filter in Python3 89/5389/1
authorYaroslav Brustinov <[email protected]>
Tue, 7 Feb 2017 13:55:04 +0000 (15:55 +0200)
committerYaroslav Brustinov <[email protected]>
Tue, 7 Feb 2017 13:55:04 +0000 (15:55 +0200)
Change-Id: I91912c31c57928eb4cc566ee483cdd31f93c4afc
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/automation/regression/stateless_tests/stl_ipv6_test.py
scripts/automation/regression/trex_unit_test.py

index 1fe248a..3f74077 100755 (executable)
@@ -19,7 +19,7 @@ class STLIPv6_Test(CStlGeneral_Test):
         ping_count = 5
         expected_replies = 4 # allow one loss
         results = self.stl_trex.ping_ip(src_port = 0, dst_ip = 'ff02::1', count = ping_count)
-        good_replies = len(filter(lambda result: result['status'] == 'success', results))
+        good_replies = len(list(filter(lambda result: result['status'] == 'success', results)))
         if self.is_loopback:
             # negative test, loopback
             if good_replies > 0:
@@ -35,7 +35,7 @@ class STLIPv6_Test(CStlGeneral_Test):
 
         # negative test, unknown IP
         results = self.stl_trex.ping_ip(src_port = 0, dst_ip = '1234::1234', count = ping_count)
-        good_replies = len(filter(lambda result: result['status'] == 'success', results))
+        good_replies = len(list(filter(lambda result: result['status'] == 'success', results)))
         if good_replies > 0:
             self.fail('We have answers from unknown IPv6, bug!\nOutput: %s' % results)
         else:
index ac6203b..6d7f26f 100755 (executable)
@@ -70,13 +70,13 @@ def id_split(idval):
 # option to select wanted test by name without file, class etc.
 def new_Selector_wantMethod(self, method, orig_Selector_wantMethod = Selector.wantMethod):
     result = orig_Selector_wantMethod(self, method)
-    return result and (not CTRexScenario.test or filter(lambda t: t in getattr(method, '__name__', ''), CTRexScenario.test.split(',')))
+    return result and (not CTRexScenario.test or list(filter(lambda t: t in getattr(method, '__name__', ''), CTRexScenario.test.split(','))))
 
 Selector.wantMethod = new_Selector_wantMethod
 
 def new_Selector_wantFunction(self, function, orig_Selector_wantFunction = Selector.wantFunction):
     result = orig_Selector_wantFunction(self, function)
-    return result and (not CTRexScenario.test or filter(lambda t: t in getattr(function, '__name__', ''), CTRexScenario.test.split(',')))
+    return result and (not CTRexScenario.test or list(filter(lambda t: t in getattr(function, '__name__', ''), CTRexScenario.test.split(','))))
 
 Selector.wantFunction = new_Selector_wantFunction