]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/conftest.py
topogen: first code import
[mirror_frr.git] / tests / topotests / conftest.py
CommitLineData
1fca63c1
RZ
1"""
2Topotest conftest.py file.
3"""
4
5from lib.topogen import get_topogen
6import pytest
7
8def pytest_addoption(parser):
9 """
10 Add topology-only option to the topology tester. This option makes pytest
11 only run the setup_module() to setup the topology without running any tests.
12 """
13 parser.addoption('--topology-only', action='store_true',
14 help='Only set up this topology, don\'t run tests')
15
16def pytest_runtest_call():
17 """
18 This function must be run after setup_module(), it does standarized post
19 setup routines. It is only being used for the 'topology-only' option.
20 """
21 # pylint: disable=E1101
22 # Trust me, 'config' exists.
23 if pytest.config.getoption('--topology-only'):
24 # Allow user to play with the setup.
25 get_topogen().mininet_cli()
26 pytest.exit('the topology executed successfully')