From: Paul Vinciguerra Date: Tue, 3 Dec 2019 02:42:28 +0000 (-0500) Subject: tests: fix exception handling around vapi.connect()/.disconnect() X-Git-Tag: v20.05-rc0~264 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=1043fd38d83434d6c4e002c5354a30027988fbfa tests: fix exception handling around vapi.connect()/.disconnect() vapi.connect() only raises subclasses of vpp_papi.VPPIOError. vapi.disconnect() doesn't raise any exceptions, removed uneeded try block. Type: test Change-Id: Ide6e6db298b205f14382065862e358757619a5ba Signed-off-by: Paul Vinciguerra --- diff --git a/test/framework.py b/test/framework.py index 24ee8692976..affd4481912 100644 --- a/test/framework.py +++ b/test/framework.py @@ -28,6 +28,7 @@ from vpp_sub_interface import VppSubInterface from vpp_lo_interface import VppLoInterface from vpp_bvi_interface import VppBviInterface from vpp_papi_provider import VppPapiProvider +import vpp_papi from vpp_papi.vpp_stats import VPPStats from vpp_papi.vpp_transport_shmem import VppTransportShmemIOError from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \ @@ -571,11 +572,10 @@ class VppTestCase(unittest.TestCase): raise try: cls.vapi.connect() - except Exception: - try: - cls.vapi.disconnect() - except Exception: - pass + except vpp_papi.VPPIOError as e: + cls.logger.debug("Exception connecting to vapi: %s" % e) + cls.vapi.disconnect() + if cls.debug_gdbserver: print(colorize("You're running VPP inside gdbserver but " "VPP-API connection failed, did you forget "