summaryrefslogtreecommitdiff
path: root/tests/topotests/conftest.py
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2019-09-30 21:15:15 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2019-09-30 21:15:15 -0300
commitc8c265f5713bcc1e67bd61016d1a93e4f899c9ac (patch)
tree09389cedb8d28443234578f598cf7a07d791486b /tests/topotests/conftest.py
parent44cde8a39faac62c488368a9c352f9a40c8ea812 (diff)
topotests: skip tests when any assert fails
When an `assert` fails we should skip all other tests on the file. Once a failure is detected we can't rely on the setup anymore, since most of the tests assume the previous worked. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'tests/topotests/conftest.py')
-rwxr-xr-xtests/topotests/conftest.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py
index 49e48ba927..76b0ab017e 100755
--- a/tests/topotests/conftest.py
+++ b/tests/topotests/conftest.py
@@ -74,3 +74,9 @@ def pytest_runtest_makereport(item, call):
parent._previousfailed = item
logger.error('assert failed at "{}/{}": {}'.format(
modname, item.name, call.excinfo.value))
+
+ # (topogen) Set topology error to avoid advancing in the test.
+ tgen = get_topogen()
+ if tgen is not None:
+ # This will cause topogen to report error on `routers_have_failure`.
+ tgen.set_error('{}/{}'.format(modname, item.name))