]>
Commit | Line | Data |
---|---|---|
1fca63c1 RZ |
1 | """ |
2 | Topotest conftest.py file. | |
3 | """ | |
4 | ||
5 | from lib.topogen import get_topogen | |
6 | import pytest | |
7 | ||
8 | def 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 | ||
16 | def 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') |