From: Rafael Zalamena Date: Tue, 1 Oct 2019 00:15:15 +0000 (-0300) Subject: topotests: skip tests when any assert fails X-Git-Tag: base_7.3~292^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F5087%2Fhead;p=mirror%2Ffrr.git 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 --- 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))