google / mobly

E2E test framework for tests with complex environment requirements.
https://github.com/google/mobly
Apache License 2.0
642 stars 179 forks source link

Add fallback for jrpc client connection when failing to connect. #678

Closed BryanDClark closed 4 years ago

BryanDClark commented 4 years ago

The ADB proxy server may be listening on 127.0.0.1 on machines where localhost resolves to [::1], which will raise a 'ConnectionRefusedError'.


This change is Reviewable

google-cla[bot] commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

xpconanfan commented 4 years ago

Looks like CI is broken. Please fix the test.

BryanDClark commented 4 years ago

Hm...looks like one of the checks failed because 'ConnectionRefusedError' doesn't exist in python2. Should I switch this to catch all exceptions so it's python2 compatible?

xpconanfan commented 4 years ago

What error does it throw in py2?

BryanDClark commented 4 years ago

socket.error, I believe: https://docs.python.org/2/library/socket.html#socket.error

BryanDClark commented 4 years ago

I updated the except statement to catch exceptions based on the python version, seems to work for python3 (I'll let the presubmit check for python2)

xpconanfan commented 4 years ago

Could you add a TODO to use a more specific error type after PY2 is deprecated from this code base?

BryanDClark commented 4 years ago

Added a TODO