diff options
author | Imcom Jin <jinyu.bjut@gmail.com> | 2020-08-31 17:58:01 +0800 |
---|---|---|
committer | Imcom Jin <jinyu.bjut@gmail.com> | 2020-08-31 17:58:01 +0800 |
commit | af37271526725a3f1c4b89ab2c1a1f4e9d4f27c2 (patch) | |
tree | a42f8775eaf99c4eed8e45705289f2a0337a318a | |
parent | a4d5d004cc3d97c90de0c2d91f2312525e055d68 (diff) |
added `.env` file for vscode to find test/lib module
replace `is not` exp in *_test.py files to suppress python syntax warning with py3
29 files changed, 31 insertions, 53 deletions
@@ -0,0 +1 @@ +PYTHONPATH=./test
\ No newline at end of file diff --git a/test/scenario_test/addpath_test.py b/test/scenario_test/addpath_test.py index 23d3b5cb..44fac9c2 100644 --- a/test/scenario_test/addpath_test.py +++ b/test/scenario_test/addpath_test.py @@ -269,7 +269,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/aspath_test.py b/test/scenario_test/aspath_test.py index e8227adf..6c41f5f8 100644 --- a/test/scenario_test/aspath_test.py +++ b/test/scenario_test/aspath_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -173,7 +172,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_confederation_test.py b/test/scenario_test/bgp_confederation_test.py index 9fdd4a74..9d24fdd6 100644 --- a/test/scenario_test/bgp_confederation_test.py +++ b/test/scenario_test/bgp_confederation_test.py @@ -14,8 +14,6 @@ # limitations under the License. - - import sys import time import unittest @@ -148,7 +146,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_malformed_msg_handling_test.py b/test/scenario_test/bgp_malformed_msg_handling_test.py index 5f0c4ce4..090e3d3e 100644 --- a/test/scenario_test/bgp_malformed_msg_handling_test.py +++ b/test/scenario_test/bgp_malformed_msg_handling_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -99,7 +98,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py index 87add9a9..59b9a797 100644 --- a/test/scenario_test/bgp_router_test.py +++ b/test/scenario_test/bgp_router_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import json import sys import time @@ -472,7 +471,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_unnumbered_test.py b/test/scenario_test/bgp_unnumbered_test.py index 7ebb50da..70ee1082 100644 --- a/test/scenario_test/bgp_unnumbered_test.py +++ b/test/scenario_test/bgp_unnumbered_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import unittest from lib import base from lib.base import BGP_FSM_ESTABLISHED, local @@ -47,6 +46,7 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(initial_wait_time + 2) done = False + def f(ifname, ctn): out = ctn.local('ip -6 n', capture=True) l = [line for line in out.split('\n') if ifname in line] @@ -90,7 +90,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_zebra_nht_test.py b/test/scenario_test/bgp_zebra_nht_test.py index 7dd61212..9359328d 100644 --- a/test/scenario_test/bgp_zebra_nht_test.py +++ b/test/scenario_test/bgp_zebra_nht_test.py @@ -284,7 +284,7 @@ class ZebraNHTTest(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/bgp_zebra_test.py b/test/scenario_test/bgp_zebra_test.py index a9f2a0b2..b5000c14 100644 --- a/test/scenario_test/bgp_zebra_test.py +++ b/test/scenario_test/bgp_zebra_test.py @@ -303,7 +303,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/evpn_test.py b/test/scenario_test/evpn_test.py index 6490cf58..a9d3c0e7 100644 --- a/test/scenario_test/evpn_test.py +++ b/test/scenario_test/evpn_test.py @@ -14,7 +14,6 @@ # limitations under the License. - from itertools import combinations import sys import time @@ -144,7 +143,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/flow_spec_test.py b/test/scenario_test/flow_spec_test.py index c7a43ce7..9d18aa47 100644 --- a/test/scenario_test/flow_spec_test.py +++ b/test/scenario_test/flow_spec_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -409,7 +408,7 @@ class FlowSpecTest(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py index 239464b7..a67cb327 100644 --- a/test/scenario_test/global_policy_test.py +++ b/test/scenario_test/global_policy_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -291,7 +290,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/graceful_restart_test.py b/test/scenario_test/graceful_restart_test.py index 18c5f55f..db6fe8e9 100644 --- a/test/scenario_test/graceful_restart_test.py +++ b/test/scenario_test/graceful_restart_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -230,7 +229,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/ibgp_router_test.py b/test/scenario_test/ibgp_router_test.py index ba8382c0..15cfe84f 100644 --- a/test/scenario_test/ibgp_router_test.py +++ b/test/scenario_test/ibgp_router_test.py @@ -14,7 +14,6 @@ # limitations under the License. - from itertools import combinations import sys import time @@ -292,7 +291,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/long_lived_graceful_restart_test.py b/test/scenario_test/long_lived_graceful_restart_test.py index 4c185894..335593d4 100644 --- a/test/scenario_test/long_lived_graceful_restart_test.py +++ b/test/scenario_test/long_lived_graceful_restart_test.py @@ -14,7 +14,6 @@ # limitations under the License. - from itertools import chain import sys import time @@ -251,7 +250,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_reflector_test.py b/test/scenario_test/route_reflector_test.py index 7fbf576c..f3aeb89a 100644 --- a/test/scenario_test/route_reflector_test.py +++ b/test/scenario_test/route_reflector_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -139,7 +138,6 @@ class GoBGPTestBase(unittest.TestCase): # | (RR Client) | | (RR Client) | | (RR Client) | | (RR Client) | # +-------------+ +-------------+ +-------------+ +-------------+ - gobgp_ctn_image_name = parser_option.gobgp_image rr = GoBGPContainer(name='rr', asn=65000, router_id='192.168.1.1', ctn_image_name=gobgp_ctn_image_name, @@ -260,7 +258,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_as2_test.py b/test/scenario_test/route_server_as2_test.py index c5d62e58..e211e930 100644 --- a/test/scenario_test/route_server_as2_test.py +++ b/test/scenario_test/route_server_as2_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import unittest import sys import time @@ -110,7 +109,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_ipv4_v6_test.py b/test/scenario_test/route_server_ipv4_v6_test.py index f40b47de..be70f633 100644 --- a/test/scenario_test/route_server_ipv4_v6_test.py +++ b/test/scenario_test/route_server_ipv4_v6_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -168,7 +167,7 @@ class GoBGPIPv6Test(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_malformed_test.py b/test/scenario_test/route_server_malformed_test.py index 1d60a27a..bec9934d 100644 --- a/test/scenario_test/route_server_malformed_test.py +++ b/test/scenario_test/route_server_malformed_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -543,7 +542,7 @@ class TestGoBGPBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_policy_grpc_test.py b/test/scenario_test/route_server_policy_grpc_test.py index 20661819..a312c131 100644 --- a/test/scenario_test/route_server_policy_grpc_test.py +++ b/test/scenario_test/route_server_policy_grpc_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -2709,7 +2708,7 @@ class TestGoBGPBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py index 2c6bd4a0..089051ba 100644 --- a/test/scenario_test/route_server_policy_test.py +++ b/test/scenario_test/route_server_policy_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -3184,7 +3183,7 @@ class TestGoBGPBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_softreset_test.py b/test/scenario_test/route_server_softreset_test.py index b801a819..8edb829c 100644 --- a/test/scenario_test/route_server_softreset_test.py +++ b/test/scenario_test/route_server_softreset_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -135,7 +134,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_test.py b/test/scenario_test/route_server_test.py index 4f89de8c..a12c7aeb 100644 --- a/test/scenario_test/route_server_test.py +++ b/test/scenario_test/route_server_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -250,7 +249,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/route_server_test2.py b/test/scenario_test/route_server_test2.py index e070bc0b..bdcad53b 100644 --- a/test/scenario_test/route_server_test2.py +++ b/test/scenario_test/route_server_test2.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -101,7 +100,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/rtc_test.py b/test/scenario_test/rtc_test.py index d5620a26..52dbed96 100644 --- a/test/scenario_test/rtc_test.py +++ b/test/scenario_test/rtc_test.py @@ -14,7 +14,6 @@ # limitations under the License. - from itertools import combinations import sys import time @@ -984,7 +983,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/vrf_neighbor_test.py b/test/scenario_test/vrf_neighbor_test.py index 6b67e968..c614f699 100644 --- a/test/scenario_test/vrf_neighbor_test.py +++ b/test/scenario_test/vrf_neighbor_test.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -169,7 +168,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/vrf_neighbor_test2.py b/test/scenario_test/vrf_neighbor_test2.py index a2502929..8c9b1343 100644 --- a/test/scenario_test/vrf_neighbor_test2.py +++ b/test/scenario_test/vrf_neighbor_test2.py @@ -14,7 +14,6 @@ # limitations under the License. - import sys import time import unittest @@ -137,7 +136,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/zapi_v3_multipath_test.py b/test/scenario_test/zapi_v3_multipath_test.py index 53ed9d2a..6f74dbdb 100644 --- a/test/scenario_test/zapi_v3_multipath_test.py +++ b/test/scenario_test/zapi_v3_multipath_test.py @@ -69,6 +69,7 @@ class GoBGPTestBase(unittest.TestCase): # Single nexthop route 10.0.0.0/24 via 127.0.0.2 dev lo proto zebra metric 20 """ + def parse_ip_route(self, ip_route_output): routes = {} current_mpath_dest = "" @@ -254,7 +255,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) diff --git a/test/scenario_test/zapi_v3_test.py b/test/scenario_test/zapi_v3_test.py index fe116488..f0531f18 100644 --- a/test/scenario_test/zapi_v3_test.py +++ b/test/scenario_test/zapi_v3_test.py @@ -147,7 +147,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) - if int(output) is not 0: + if int(output) != 0: print("docker not found") sys.exit(1) |