aboutsummaryrefslogtreecommitdiff
path: root/mobly/base_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'mobly/base_test.py')
-rw-r--r--mobly/base_test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mobly/base_test.py b/mobly/base_test.py
index e7da22c..9bf4fcc 100644
--- a/mobly/base_test.py
+++ b/mobly/base_test.py
@@ -170,6 +170,12 @@ class BaseTestClass:
the test logic.
"""
+ # Explicitly set the type since we set this to `None` in between
+ # test cases executions when there's no active test. However, since
+ # it is safe for clients to call at any point during normal execution
+ # of a Mobly test, we avoid using the `Optional` type hint for convenience.
+ current_test_info: runtime_test_info.RuntimeTestInfo
+
TAG = None
def __init__(self, configs):
@@ -797,6 +803,7 @@ class BaseTestClass:
else:
# Check if anything failed by `expects`.
if before_count < expects.recorder.error_count:
+ tr_record.test_error()
teardown_test_failed = True
except (signals.TestFailure, AssertionError) as e:
tr_record.test_fail(e)