From c8c265f5713bcc1e67bd61016d1a93e4f899c9ac Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 30 Sep 2019 21:15:15 -0300 Subject: [PATCH] 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 --- tests/topotests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)) -- 2.39.5