diff --git a/Tools/autotest/ardusub.py b/Tools/autotest/ardusub.py index d011228e68..6afb614656 100644 --- a/Tools/autotest/ardusub.py +++ b/Tools/autotest/ardusub.py @@ -3,12 +3,17 @@ # Dive ArduSub in SITL from __future__ import print_function import os +import sys import time from pymavlink import mavutil from common import AutoTest from common import NotAchievedException +from common import AutoTestTimeoutException + +if sys.version_info[0] < 3: + ConnectionResetError = AutoTestTimeoutException # get location of scripts testdir = os.path.dirname(os.path.realpath(__file__)) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index b997b98b0b..0905af33b8 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -91,6 +91,10 @@ class AutoTestTimeoutException(ErrorException): pass +if sys.version_info[0] < 3: + ConnectionResetError = AutoTestTimeoutException + + class WaitModeTimeout(AutoTestTimeoutException): """Thrown when fails to achieve given mode change.""" pass @@ -1559,6 +1563,11 @@ class AutoTest(ABC): pass except ConnectionResetError: pass + except socket.error: + pass + except Exception as e: + self.progress("Got unexpected exception (%s)" % str(type(e))) + pass # empty mav to avoid getting old timestamps: self.do_timesync_roundtrip(timeout_in_wallclock=True)