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>
diff --git a/test/test_p2p_ethernet.py b/test/test_p2p_ethernet.py
index b0d546e..5200e48 100644
--- a/test/test_p2p_ethernet.py
+++ b/test/test_p2p_ethernet.py
@@ -48,22 +48,22 @@
self.create_p2p_ethernet(self.pg0, 2, "de:ad:00:00:00:02")
intfs = self.vapi.cli("show interface")
- self.assertNotEqual(intfs.find('pg0.1'), -1)
- self.assertNotEqual(intfs.find('pg0.2'), -1)
- self.assertEqual(intfs.find('pg0.5'), -1)
+ self.assertIn('pg0.1', intfs)
+ self.assertIn('pg0.2', intfs)
+ self.assertNotIn('pg0.5', intfs)
# create pg2.5 subif
self.create_p2p_ethernet(self.pg0, 5, "de:ad:00:00:00:ff")
intfs = self.vapi.cli("show interface")
- self.assertNotEqual(intfs.find('pg0.5'), -1)
+ self.assertIn('pg0.5', intfs)
# delete pg2.5 subif
self.delete_p2p_ethernet(self.pg0, "de:ad:00:00:00:ff")
intfs = self.vapi.cli("show interface")
- self.assertNotEqual(intfs.find('pg0.1'), -1)
- self.assertNotEqual(intfs.find('pg0.2'), -1)
- self.assertEqual(intfs.find('pg0.5'), -1)
+ self.assertIn('pg0.1', intfs)
+ self.assertIn('pg0.2', intfs)
+ self.assertNotIn('pg0.5', intfs)
self.logger.info("FFP_TEST_FINISH_0000")