From 955212d91bc858349609b1ec9bff4351b2b8caf5 Mon Sep 17 00:00:00 2001 From: nguggarigoud Date: Tue, 15 Sep 2020 11:09:43 +0530 Subject: [PATCH] tests: fixing pytest.skip error. Updated scripts to handle skip on lower kernel version. Signed-off-by: naveen --- .../test_bgp_basic_functionality.py | 7 ++----- tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py | 4 ++-- tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py | 4 ++-- tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py | 4 ++-- .../bgp_communities_topo1/test_bgp_communities.py | 4 ++-- .../test_bgp_gr_functionality_topo1.py | 4 ++-- .../test_bgp_gr_functionality_topo2.py | 4 ++-- .../bgp_large_community/test_bgp_large_community_topo_1.py | 4 ++-- .../bgp_large_community/test_bgp_large_community_topo_2.py | 4 ++-- .../bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py | 6 +++--- .../bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py | 6 +++--- 11 files changed, 24 insertions(+), 27 deletions(-) diff --git a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py index b34c001ca2..41fa7c0a09 100755 --- a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py +++ b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py @@ -69,7 +69,6 @@ from lib.common_config import ( create_static_routes, verify_rib, verify_admin_distance_for_static_routes, -<<<<<<< ff9ae8fbb8f14b1cf5679d3278341edd09e7d8bf check_address_types, apply_raw_config, addKernelRoute, @@ -77,9 +76,7 @@ from lib.common_config import ( create_prefix_lists, create_route_maps, verify_bgp_community, -======= required_linux_kernel_version ->>>>>>> tests: Moving kernel version check to API. ) from lib.topolog import logger from lib.bgp import ( @@ -143,8 +140,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py index 63e5a9f9b2..6068f5f831 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -111,8 +111,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py index 883dc92438..ae54019a0f 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -111,8 +111,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py index 4db4d1a8b9..f9d22a3a36 100755 --- a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py +++ b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py @@ -115,8 +115,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py index 88c5e0df19..57e8e0d34a 100644 --- a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py +++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py @@ -105,8 +105,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py index 30757809c4..fdbd317093 100755 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py @@ -189,8 +189,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index 8bec22c577..e1ec0ea81b 100755 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -186,8 +186,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") global ADDR_TYPES diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py index fe9e8504ad..dc06b7131a 100755 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py @@ -145,8 +145,8 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") global ADDR_TYPES testsuite_run_time = time.asctime(time.localtime(time.time())) diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py index d890fe127d..bb88e47415 100755 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py @@ -136,8 +136,8 @@ def setup_module(mod): # Required linux kernel version for this suite to run. result = required_linux_kernel_version('4.15') - if result: - pytest.skip(result) + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py index 6ecc11119f..c15b88d371 100755 --- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py +++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py @@ -211,9 +211,9 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.19') - if result: - pytest.skip(result) + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index 18c4a5dc75..bb13d54019 100755 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -143,9 +143,9 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.19') - if result: - pytest.skip(result) + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) -- 2.39.5