2020
2121# Disable those warnings, since 'lisa' is an external, non-standard, dependency
2222# E0401: Unable to import 'lisa' (import-error)
23- # etc
24- from lisa import ( # pylint: disable=E0401
25- notifier
26- )
23+ from lisa import notifier # pylint: disable=E0401
2724from lisa .messages import TestStatus , TestResultMessage # pylint: disable=E0401
25+
26+ from typing import Optional
27+
2828from azurelinuxagent .common .future import UTC
2929
3030
31+ class AgentTestResultMessage (TestResultMessage ):
32+ def __init__ (self , suite_name : str , test_name : str , status : TestStatus ):
33+ super ().__init__ ()
34+ self .type : str = "AgentTestResultMessage"
35+ self .id_ : str = str (uuid .uuid4 ())
36+ self .status : TestStatus = status
37+ self .suite_full_name : str = suite_name
38+ self .suite_name : str = suite_name
39+ self .full_name : str = test_name
40+ self .name : str = test_name
41+ self .elapsed : float = 0
42+ self .message : str = ""
43+ self .stacktrace : Optional [str ] = None
44+
45+
3146class AgentTestResult :
3247 @staticmethod
3348 def report (
@@ -42,15 +57,7 @@ def report(
4257 Reports a test result to the junit notifier
4358 """
4459 # The junit notifier requires an initial RUNNING message in order to register the test in its internal cache.
45- msg : TestResultMessage = TestResultMessage ()
46- msg .type = "AgentTestResultMessage"
47- msg .id_ = str (uuid .uuid4 ())
48- msg .status = TestStatus .RUNNING
49- msg .suite_full_name = suite_name
50- msg .suite_name = msg .suite_full_name
51- msg .full_name = test_name
52- msg .name = msg .full_name
53- msg .elapsed = 0
60+ msg : AgentTestResultMessage = AgentTestResultMessage (suite_name , test_name , TestStatus .RUNNING )
5461
5562 notifier .notify (msg )
5663
0 commit comments