From ac9c1bb32f4a2d02e8e661f2b4f3ce628f3a9c6b Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 10 Aug 2017 10:59:40 +0200 Subject: esme: Add cleanup function to avoid cascade failure of tests In commit 6100b629e55ed4aa319f46ad797741131b9da8e7 I assumed esme already had a cleanup function, which doesn't seem to be the case. This means if a test calls esme.connect() and fails afterwards without calling esme.disconnect(), the connection will be kept but as the test will finish and the NITB is closed, then the connection will be kept forever in an erroneous state. With the cleanup function we ensure we will close the connection after the test. Change-Id: Ia3a23bb8bbccfe7ac5c544521b5566164609f0a5 --- src/osmo_gsm_tester/esme.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/osmo_gsm_tester/esme.py') diff --git a/src/osmo_gsm_tester/esme.py b/src/osmo_gsm_tester/esme.py index 7063c33..376152a 100644 --- a/src/osmo_gsm_tester/esme.py +++ b/src/osmo_gsm_tester/esme.py @@ -52,6 +52,9 @@ class Esme(log.Origin): self.next_user_message_reference = 1 def __del__(self): + self.cleanup() + + def cleanup(self): try: self.disconnect() except smpplib.exceptions.ConnectionError: -- cgit v1.2.3