summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-05-02 14:43:18 -0400
committerMark Stapp <mjs@voltanet.io>2019-05-02 14:43:18 -0400
commit80cb48d2f47d72e497c2c9430ddb28febff259cc (patch)
tree71d7aa050afdb7b6d6c68270a65d5857aa11ff30
parentbcbce7b283a716f44953ab1a8b67c20d2b6725c6 (diff)
topotest: fix pytest deprecation warning
As of pytest 4.something, a pattern we were using in conftest.py was deprecated. Also make a new-ish test script executable (all the rest appear to be?) Signed-off-by: Mark Stapp <mjs@voltanet.io>
-rwxr-xr-x[-rw-r--r--]tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py0
-rwxr-xr-xtests/topotests/conftest.py14
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py b/tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py
index b0d60403db..b0d60403db 100644..100755
--- a/tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py
+++ b/tests/topotests/bgp-vrf-route-leak-basic/test_bgp.py
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py
index 327e4625f2..49e48ba927 100755
--- a/tests/topotests/conftest.py
+++ b/tests/topotests/conftest.py
@@ -7,6 +7,8 @@ from lib.topotest import json_cmp_result
from lib.topolog import logger
import pytest
+topology_only = False
+
def pytest_addoption(parser):
"""
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
setup routines. It is only being used for the 'topology-only' option.
"""
- # pylint: disable=E1101
- # Trust me, 'config' exists.
- if pytest.config.getoption('--topology-only'):
+ global topology_only
+
+ if topology_only:
tgen = get_topogen()
if tgen is not None:
# Allow user to play with the setup.
@@ -44,9 +46,15 @@ def pytest_assertrepr_compare(op, left, right):
def pytest_configure(config):
"Assert that the environment is correctly configured."
+
+ global topology_only
+
if not diagnose_env():
pytest.exit('enviroment has errors, please read the logs')
+ if config.getoption('--topology-only'):
+ topology_only = True
+
def pytest_runtest_makereport(item, call):
"Log all assert messages to default logger with error level"
# Nothing happened