Add the ability for our topotests to take advantage of pytest `mark`ing.
This effectively allows you to tell pytest to run against certain sets
of tests. For a demonstration purpose I've added in marks for:
babel
eigrp
ldp
ospf
pim
rip
And setup tests to run against those tests that only test those protocols.
You can run against eigrp tests by running `pytest -k eigrp`
Other combinations are also available based upon simple boolean logic.
Just read the pytest.mark documentation.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
##
#####################################################
-
+@pytest.mark.ospf
+@pytest.mark.rip
def setup_module(module):
global topo, net
global fatal_error
host = tgen.gears[host_name]
config_host(host_name, host)
-
+@pytest.mark.pim
def setup_module(module):
"Setup topology"
tgen = Topogen(NetworkTopo, module.__name__)
##
#####################################################
-
+@pytest.mark.eigrp
def setup_module(module):
"Setup topology"
tgen = Topogen(NetworkTopo, module.__name__)
##
#####################################################
-
+@pytest.mark.pim
def setup_module(module):
"Setup topology"
tgen = Topogen(NetworkTopo, module.__name__)
##
#####################################################
-
+@pytest.mark.ldp
def setup_module(module):
global topo, net
global fatal_error
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__)
sw.add_link(tgen.gears["r1"])
sw.add_link(tgen.gears["r3"])
-
+@pytest.mark.pim
def setup_module(mod):
"Sets up the pytest environment"
tgen = Topogen(PIMTopo, mod.__name__)
# Skip pytests example directory
[pytest]
norecursedirs = .git example-test example-topojson-test lib docker
+markers =
+ babel: Tests that run against BABEL
+ eigrp: Tests that run against EIGRPD
+ ldp: Tests that run against LDPD
+ ospf: Tests that run against OSPF( v2 and v3 )
+ pim: Tests that run against pim
+ rip: Tests that run against RIP, both v4 and v6
[topogen]
# Default configuration values
##
#####################################################
-
+@pytest.mark.rip
def setup_module(module):
global topo, net
##
#####################################################
-
+@pytest.mark.rip
def setup_module(module):
global topo, net