From 6907ac7e2cd032106fde177ea423a82a653194ef Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 23 Jan 2021 15:13:12 -0500 Subject: [PATCH] tests: Fixup to use the new `pytestmark =` syntax Go through all the current tests and convert over to correct syntax Signed-off-by: Donald Sharp --- .../all-protocol-startup/test_all_protocol_startup.py | 5 ++--- .../topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py | 2 +- tests/topotests/bfd-isis-topo1/test_bfd_isis_topo1.py | 4 ++-- .../topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py | 4 ++-- tests/topotests/bfd-topo1/test_bfd_topo1.py | 3 ++- tests/topotests/bfd-topo2/test_bfd_topo2.py | 3 ++- tests/topotests/bfd-vrf-topo1/test_bfd_vrf_topo1.py | 3 ++- tests/topotests/bgp-evpn-mh/test_evpn_mh.py | 2 +- tests/topotests/eigrp-topo1/test_eigrp_topo1.py | 4 +++- tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py | 2 +- tests/topotests/isis-lfa-topo1/test_isis_lfa_topo1.py | 3 ++- tests/topotests/isis-rlfa-topo1/test_isis_rlfa_topo1.py | 3 ++- tests/topotests/isis-sr-te-topo1/test_isis_sr_te_topo1.py | 3 ++- tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py | 3 ++- tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py | 3 ++- tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py | 3 ++- tests/topotests/isis-topo1/test_isis_topo1.py | 3 ++- tests/topotests/ldp-topo1/test_ldp_topo1.py | 4 +++- tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py | 4 ++-- tests/topotests/pbr-topo1/test_pbr_topo1.py | 3 ++- tests/topotests/pim-basic/test_pim.py | 1 + tests/topotests/rip-topo1/test_rip_topo1.py | 3 ++- tests/topotests/ripng-topo1/test_ripng_topo1.py | 3 ++- 23 files changed, 44 insertions(+), 27 deletions(-) diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py index 5942aca71d..ce5f1158ac 100644 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -43,6 +43,8 @@ from mininet.link import Intf from functools import partial +pytestmark = [pytest.mark.isisd, pytest.mark.ospfd, pytest.mark.ripd] + sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from lib import topotest @@ -83,9 +85,6 @@ class NetworkTopo(Topo): ##################################################### -@pytest.mark.isis -@pytest.mark.ospf -@pytest.mark.rip def setup_module(module): global topo, net global fatal_error diff --git a/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py b/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py index cc1c1e3a0c..4c3bad1280 100644 --- a/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py +++ b/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py @@ -44,6 +44,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd] class BFDTopo(Topo): "Test topology builder" @@ -64,7 +65,6 @@ class BFDTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r3"]) -@pytest.mark.bfd def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(BFDTopo, mod.__name__) diff --git a/tests/topotests/bfd-isis-topo1/test_bfd_isis_topo1.py b/tests/topotests/bfd-isis-topo1/test_bfd_isis_topo1.py index 23da7ed850..bb930141ac 100644 --- a/tests/topotests/bfd-isis-topo1/test_bfd_isis_topo1.py +++ b/tests/topotests/bfd-isis-topo1/test_bfd_isis_topo1.py @@ -90,6 +90,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd, pytest.mark.isisd] class TemplateTopo(Topo): "Test topology builder" @@ -127,8 +128,7 @@ class TemplateTopo(Topo): switch.add_link(tgen.gears["rt4"], nodeif="eth-rt5") switch.add_link(tgen.gears["rt5"], nodeif="eth-rt4") -@pytest.mark.bfd -@pytest.mark.isis + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py b/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py index 6283f03ddf..74e3fd9ce0 100644 --- a/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py +++ b/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py @@ -45,6 +45,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd, pytest.mark.isisd] class BFDProfTopo(Topo): "Test topology builder" @@ -77,8 +78,7 @@ class BFDProfTopo(Topo): switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears["r6"]) -@pytest.mark.bfd -@pytest.mark.isis + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(BFDProfTopo, mod.__name__) diff --git a/tests/topotests/bfd-topo1/test_bfd_topo1.py b/tests/topotests/bfd-topo1/test_bfd_topo1.py index 4c13fdcfc5..76078b5d7d 100644 --- a/tests/topotests/bfd-topo1/test_bfd_topo1.py +++ b/tests/topotests/bfd-topo1/test_bfd_topo1.py @@ -45,6 +45,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd] class BFDTopo(Topo): "Test topology builder" @@ -69,7 +70,7 @@ class BFDTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r4"]) -@pytest.mark.bfd + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(BFDTopo, mod.__name__) diff --git a/tests/topotests/bfd-topo2/test_bfd_topo2.py b/tests/topotests/bfd-topo2/test_bfd_topo2.py index 5181a40f47..0d7e71974f 100644 --- a/tests/topotests/bfd-topo2/test_bfd_topo2.py +++ b/tests/topotests/bfd-topo2/test_bfd_topo2.py @@ -46,6 +46,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd] class BFDTopo(Topo): "Test topology builder" @@ -70,7 +71,7 @@ class BFDTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r4"]) -@pytest.mark.bfd + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(BFDTopo, mod.__name__) diff --git a/tests/topotests/bfd-vrf-topo1/test_bfd_vrf_topo1.py b/tests/topotests/bfd-vrf-topo1/test_bfd_vrf_topo1.py index 956b526583..a238ff8da3 100644 --- a/tests/topotests/bfd-vrf-topo1/test_bfd_vrf_topo1.py +++ b/tests/topotests/bfd-vrf-topo1/test_bfd_vrf_topo1.py @@ -46,6 +46,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.bfdd] class BFDTopo(Topo): "Test topology builder" @@ -70,7 +71,7 @@ class BFDTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r4"]) -@pytest.mark.bfd + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(BFDTopo, mod.__name__) diff --git a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py index 61be947a71..aec78179ff 100644 --- a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py +++ b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py @@ -35,7 +35,7 @@ import json import platform from functools import partial -pytestmark = pytest.mark.pimd +pytestmark = [pytest.mark.pimd] # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/topotests/eigrp-topo1/test_eigrp_topo1.py b/tests/topotests/eigrp-topo1/test_eigrp_topo1.py index bf94d39a4b..6993bc53e7 100644 --- a/tests/topotests/eigrp-topo1/test_eigrp_topo1.py +++ b/tests/topotests/eigrp-topo1/test_eigrp_topo1.py @@ -33,6 +33,8 @@ import sys import pytest import json +pytestmark = [pytest.mark.eigrpd] + # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) @@ -91,7 +93,7 @@ class NetworkTopo(Topo): ## ##################################################### -@pytest.mark.eigrp + def setup_module(module): "Setup topology" tgen = Topogen(NetworkTopo, module.__name__) diff --git a/tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py b/tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py index d8c0cdc2fd..260a197aca 100644 --- a/tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py +++ b/tests/topotests/evpn-pim-1/test_evpn_pim_topo1.py @@ -34,7 +34,7 @@ import pytest import json from functools import partial -pytestmark = pytest.mark.pimd +pytestmark = [pytest.mark.pimd] # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/topotests/isis-lfa-topo1/test_isis_lfa_topo1.py b/tests/topotests/isis-lfa-topo1/test_isis_lfa_topo1.py index a655b418cf..ab15c3542f 100755 --- a/tests/topotests/isis-lfa-topo1/test_isis_lfa_topo1.py +++ b/tests/topotests/isis-lfa-topo1/test_isis_lfa_topo1.py @@ -73,6 +73,8 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] + # Global multi-dimensional dictionary containing all expected outputs outputs = {} @@ -163,7 +165,6 @@ class TemplateTopo(Topo): f_in.close() f_out.close() -@pytest.mark.isis def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/isis-rlfa-topo1/test_isis_rlfa_topo1.py b/tests/topotests/isis-rlfa-topo1/test_isis_rlfa_topo1.py index bb43e6b114..4c692841ac 100755 --- a/tests/topotests/isis-rlfa-topo1/test_isis_rlfa_topo1.py +++ b/tests/topotests/isis-rlfa-topo1/test_isis_rlfa_topo1.py @@ -82,6 +82,8 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] + # Global multi-dimensional dictionary containing all expected outputs outputs = {} @@ -165,7 +167,6 @@ class TemplateTopo(Topo): f_in.close() f_out.close() -@pytest.mark.isis def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/isis-sr-te-topo1/test_isis_sr_te_topo1.py b/tests/topotests/isis-sr-te-topo1/test_isis_sr_te_topo1.py index bfd2f92a28..d7c95f28b8 100755 --- a/tests/topotests/isis-sr-te-topo1/test_isis_sr_te_topo1.py +++ b/tests/topotests/isis-sr-te-topo1/test_isis_sr_te_topo1.py @@ -96,6 +96,8 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] + class TemplateTopo(Topo): "Test topology builder" def build(self, *_args, **_opts): @@ -148,7 +150,6 @@ class TemplateTopo(Topo): switch.add_link(tgen.gears['rt6'], nodeif="eth-dst") switch.add_link(tgen.gears['dst'], nodeif="eth-rt6") -@pytest.mark.isis def setup_module(mod): "Sets up the pytest environment" diff --git a/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py b/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py index 63be3f78aa..8a7d6ee882 100644 --- a/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py +++ b/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py @@ -84,6 +84,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] class TemplateTopo(Topo): "Test topology builder" @@ -134,7 +135,7 @@ class TemplateTopo(Topo): switch.add_link(tgen.gears["rt5"], nodeif="eth-rt6") switch.add_link(tgen.gears["rt6"], nodeif="eth-rt5") -@pytest.mark.isis + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py index 83751fabcd..39b3299603 100755 --- a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py +++ b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py @@ -85,6 +85,8 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] + # Global multi-dimensional dictionary containing all expected outputs outputs = {} @@ -177,7 +179,6 @@ class TemplateTopo(Topo): f_in.close() f_out.close() -@pytest.mark.isis def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py index a79c8a268b..7bc694cbb0 100644 --- a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py +++ b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py @@ -43,6 +43,7 @@ from lib.topolog import logger from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] class ISISTopo1(Topo): "Simple two layer ISIS vrf topology" @@ -82,7 +83,7 @@ class ISISTopo1(Topo): sw.add_link(tgen.gears["r4"]) sw.add_link(tgen.gears["r5"]) -@pytest.mark.isis + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(ISISTopo1, mod.__name__) diff --git a/tests/topotests/isis-topo1/test_isis_topo1.py b/tests/topotests/isis-topo1/test_isis_topo1.py index 25116d9452..6963429288 100644 --- a/tests/topotests/isis-topo1/test_isis_topo1.py +++ b/tests/topotests/isis-topo1/test_isis_topo1.py @@ -45,6 +45,7 @@ from lib.topolog import logger from mininet.topo import Topo +pytestmark = [pytest.mark.isisd] class ISISTopo1(Topo): "Simple two layer ISIS topology" @@ -84,7 +85,7 @@ class ISISTopo1(Topo): sw.add_link(tgen.gears["r4"]) sw.add_link(tgen.gears["r5"]) -@pytest.mark.isis + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(ISISTopo1, mod.__name__) diff --git a/tests/topotests/ldp-topo1/test_ldp_topo1.py b/tests/topotests/ldp-topo1/test_ldp_topo1.py index dfe65f010e..d9e23e9ea9 100644 --- a/tests/topotests/ldp-topo1/test_ldp_topo1.py +++ b/tests/topotests/ldp-topo1/test_ldp_topo1.py @@ -77,6 +77,8 @@ from lib import topotest fatal_error = "" +pytestmark = [pytest.mark.ldpd] + ##################################################### ## ## Network Topology Definition @@ -159,7 +161,7 @@ class NetworkTopo(Topo): ## ##################################################### -@pytest.mark.ldp + def setup_module(module): global topo, net global fatal_error diff --git a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py index d659acb470..fe57f3707a 100644 --- a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py +++ b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py @@ -80,6 +80,7 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.ldpd, pytest.mark.ospfd] class TemplateTopo(Topo): "Test topology builder" @@ -121,8 +122,7 @@ class TemplateTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r3"]) -@pytest.mark.ldp -@pytest.mark.ospf + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(TemplateTopo, mod.__name__) diff --git a/tests/topotests/pbr-topo1/test_pbr_topo1.py b/tests/topotests/pbr-topo1/test_pbr_topo1.py index 5161d5eec7..4b6de51c86 100644 --- a/tests/topotests/pbr-topo1/test_pbr_topo1.py +++ b/tests/topotests/pbr-topo1/test_pbr_topo1.py @@ -49,6 +49,8 @@ from lib.common_config import shutdown_bringup_interface # Required to instantiate the topology builder class. from mininet.topo import Topo +pytestmark = [pytest.mark.pbrd] + ##################################################### ## ## Network Topology Definition @@ -80,7 +82,6 @@ class NetworkTopo(Topo): ## ##################################################### -@pytest.mark.pbr def setup_module(module): "Setup topology" tgen = Topogen(NetworkTopo, module.__name__) diff --git a/tests/topotests/pim-basic/test_pim.py b/tests/topotests/pim-basic/test_pim.py index 224b82f1fb..918d3847ce 100644 --- a/tests/topotests/pim-basic/test_pim.py +++ b/tests/topotests/pim-basic/test_pim.py @@ -43,6 +43,7 @@ from lib.topolog import logger from mininet.topo import Topo +pytestmark = [pytest.mark.pimd] class PIMTopo(Topo): def build(self, *_args, **_opts): diff --git a/tests/topotests/rip-topo1/test_rip_topo1.py b/tests/topotests/rip-topo1/test_rip_topo1.py index edad1ff65d..78672ac871 100644 --- a/tests/topotests/rip-topo1/test_rip_topo1.py +++ b/tests/topotests/rip-topo1/test_rip_topo1.py @@ -47,6 +47,7 @@ from lib import topotest fatal_error = "" +pytestmark = [pytest.mark.ripd] ##################################################### ## @@ -104,7 +105,7 @@ class NetworkTopo(Topo): ## ##################################################### -@pytest.mark.rip + def setup_module(module): global topo, net diff --git a/tests/topotests/ripng-topo1/test_ripng_topo1.py b/tests/topotests/ripng-topo1/test_ripng_topo1.py index 47b63e5b26..4a5a59cd75 100644 --- a/tests/topotests/ripng-topo1/test_ripng_topo1.py +++ b/tests/topotests/ripng-topo1/test_ripng_topo1.py @@ -48,6 +48,7 @@ from lib import topotest fatal_error = "" +pytestmark = [pytest.mark.ripd] ##################################################### ## @@ -104,7 +105,7 @@ class NetworkTopo(Topo): ## ##################################################### -@pytest.mark.rip + def setup_module(module): global topo, net -- 2.39.5