mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 05:27:47 +00:00
Merge pull request #4247 from mjstapp/fix_topotest_topo_only
topotest: fix pytest deprecation warning
This commit is contained in:
commit
43932ad63c
0
tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py
Normal file → Executable file
0
tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py
Normal file → Executable file
@ -7,6 +7,8 @@ from lib.topotest import json_cmp_result
|
|||||||
from lib.topolog import logger
|
from lib.topolog import logger
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
topology_only = False
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
"""
|
"""
|
||||||
Add topology-only option to the topology tester. This option makes pytest
|
Add topology-only option to the topology tester. This option makes pytest
|
||||||
@ -20,9 +22,9 @@ def pytest_runtest_call():
|
|||||||
This function must be run after setup_module(), it does standarized post
|
This function must be run after setup_module(), it does standarized post
|
||||||
setup routines. It is only being used for the 'topology-only' option.
|
setup routines. It is only being used for the 'topology-only' option.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=E1101
|
global topology_only
|
||||||
# Trust me, 'config' exists.
|
|
||||||
if pytest.config.getoption('--topology-only'):
|
if topology_only:
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
if tgen is not None:
|
if tgen is not None:
|
||||||
# Allow user to play with the setup.
|
# Allow user to play with the setup.
|
||||||
@ -44,9 +46,15 @@ def pytest_assertrepr_compare(op, left, right):
|
|||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
"Assert that the environment is correctly configured."
|
"Assert that the environment is correctly configured."
|
||||||
|
|
||||||
|
global topology_only
|
||||||
|
|
||||||
if not diagnose_env():
|
if not diagnose_env():
|
||||||
pytest.exit('enviroment has errors, please read the logs')
|
pytest.exit('enviroment has errors, please read the logs')
|
||||||
|
|
||||||
|
if config.getoption('--topology-only'):
|
||||||
|
topology_only = True
|
||||||
|
|
||||||
def pytest_runtest_makereport(item, call):
|
def pytest_runtest_makereport(item, call):
|
||||||
"Log all assert messages to default logger with error level"
|
"Log all assert messages to default logger with error level"
|
||||||
# Nothing happened
|
# Nothing happened
|
||||||
|
Loading…
Reference in New Issue
Block a user