mirror of https://github.com/ArduPilot/ardupilot
autotest: handle Py2 not having ConnectionResetError built in
This commit is contained in:
parent
50d80e9dc4
commit
a5706a18af
|
@ -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__))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue