Tests: use self.assertNotIn().

Many tests use self.assertEqual(error.find("failed"), -1)
Use self.assertNotIn("failed", error) to provide more meaningful errors such as
AssertionError: 'Failed' not found in '' instead of 0 != -1.

Change-Id: I670acdc977b788b2cedf94cfeafc12097781463f
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2019-03-06 15:11:28 -08:00
committed by Ole Trøan
parent f70cead5eb
commit 9a6dafd569
13 changed files with 35 additions and 35 deletions

View File

@ -35,7 +35,7 @@ class TestString(VppTestCase):
error = self.vapi.cli("test string " + name)
if error.find("failed") != -1:
self.logger.critical("FAILURE in the " + name + " test")
self.assertEqual(error.find("failed"), -1)
self.assertNotIn("failed", error)
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)