google / mobly

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

Add not None check in Logcat.create_output_excerpts. #681

Closed eric100lin closed 3 years ago

eric100lin commented 3 years ago

Sometimes, devices may accidentally go offline during test with "device 'UUID' not found" error.
In this scenario,
you will got "'NoneType' object has no attribute 'readline'" AttributeError
when you call create_output_excerpts in teardown_test().

This PR checks _adb_logcat_file_obj is not None before calling readline().
An empty excerpt would be created at excerpt_file_path if device offline.


This change is Reviewable