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>
This commit is contained in:
Rafael Zalamena 2019-09-30 21:15:15 -03:00
parent 44cde8a39f
commit c8c265f571

View File

@ -74,3 +74,9 @@ def pytest_runtest_makereport(item, call):
parent._previousfailed = item parent._previousfailed = item
logger.error('assert failed at "{}/{}": {}'.format( logger.error('assert failed at "{}/{}": {}'.format(
modname, item.name, call.excinfo.value)) 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))