Fix import order and disable broad-except pylint warning. (#788)
* Fix import order and disable broad-except pylint warning.
* Disable broad-except pylint warning in utils._kill_process_tree.
Co-authored-by: Ang Li <angli@google.com>
diff --git a/mobly/utils.py b/mobly/utils.py
index cef70fa..6015617 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -30,11 +30,11 @@
import threading
import time
import traceback
-from typing import overload, Tuple
-# TODO(ericth): Use Literal from typing if we only run on Python 3.8 or later.
-from typing_extensions import Literal
+from typing import Tuple, overload
import portpicker
+# TODO(ericth): Use Literal from typing if we only run on Python 3.8 or later.
+from typing_extensions import Literal
# File name length is limited to 255 chars on some OS, so we need to make sure
# the file names we output fits within the limit.
@@ -313,13 +313,13 @@
for child_pid in _collect_process_tree(proc.pid):
try:
os.kill(child_pid, signal.SIGTERM)
- except Exception:
+ except Exception: # pylint: disable=broad-except
failed.append(child_pid)
logging.exception('Failed to kill standing subprocess %d', child_pid)
try:
proc.kill()
- except Exception:
+ except Exception: # pylint: disable=broad-except
failed.append(proc.pid)
logging.exception('Failed to kill standing subprocess %d', proc.pid)
@@ -362,7 +362,7 @@
params = future_to_params[future]
try:
return_vals.append(future.result())
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
logging.exception('%s generated an exception: %s', params,
traceback.format_exc())
return_vals.append(exc)