X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fframework.py;h=4ecb66fe408f208d2576e8a817f9c369acd93ff6;hb=6a5adc369591fcac2447e9809deaa22f56b53911;hp=dd4774dc72ba82f33e8be2f87780fad29bc9d2ec;hpb=b9ef2739dd1e681143e78ada1ffc342ae2fb89b0;p=vpp.git diff --git a/test/framework.py b/test/framework.py index dd4774dc72b..4ecb66fe408 100644 --- a/test/framework.py +++ b/test/framework.py @@ -837,12 +837,13 @@ class VppTestCase(unittest.TestCase): "Finished sleep (%s) - slept %ss (wanted %ss)" % ( remark, after - before, timeout)) - def send_and_assert_no_replies(self, intf, pkts, remark=""): + def send_and_assert_no_replies(self, intf, pkts, remark="", timeout=None): self.vapi.cli("clear trace") intf.add_stream(pkts) self.pg_enable_capture(self.pg_interfaces) self.pg_start() - timeout = 1 + if not timeout: + timeout = 1 for i in self.pg_interfaces: i.get_capture(0, timeout=timeout) i.assert_nothing_captured(remark=remark) @@ -957,7 +958,25 @@ class VppTestResult(unittest.TestResult): if hasattr(self, 'test_framework_failed_pipe'): pipe = self.test_framework_failed_pipe if pipe: - pipe.send(test.__class__) + if test.__class__.__name__ == "_ErrorHolder": + x = str(test) + if x.startswith("setUpClass"): + # x looks like setUpClass (test_function.test_class) + cls = x.split(".")[1].split(")")[0] + for t in self.test_suite: + if t.__class__.__name__ == cls: + pipe.send(t.__class__) + break + else: + raise Exception("Can't find class name `%s' " + "(from ErrorHolder) in test suite " + "`%s'" % (cls, self.test_suite)) + else: + raise Exception("FIXME: unexpected special case - " + "ErrorHolder description is `%s'" % + str(test)) + else: + pipe.send(test.__class__) def addFailure(self, test, err): """ @@ -1192,6 +1211,8 @@ class VppTestRunner(unittest.TextTestRunner): filtered.countTestCases(), test.countTestCases())) if not running_extended_tests(): print("Not running extended tests (some tests will be skipped)") + # super-ugly hack #2 + VppTestResult.test_suite = filtered return super(VppTestRunner, self).run(filtered)