2222from allure_pytest .utils import get_outcome_status , get_outcome_status_details
2323from allure_pytest .utils import get_pytest_report_status
2424from allure_commons .utils import md5
25+ import threading
2526
2627
2728class AllureListener (object ):
@@ -36,8 +37,13 @@ def __init__(self, config):
3637 @allure_commons .hookimpl
3738 def start_step (self , uuid , title , params ):
3839 parameters = [Parameter (name = name , value = value ) for name , value in params .items ()]
39- step = TestStepResult (name = title , start = now (), parameters = parameters )
40- self .allure_logger .start_step (None , uuid , step )
40+ step = TestStepResult (name = title , start = now (), parameters = parameters , thrd = threading .current_thread ().name )
41+ if thread_tag () != self ._thread :
42+ self .allure_logger .start_step (self .allure_logger .last_with_thread (), uuid , step )
43+ else :
44+ self .allure_logger .start_step (None , uuid , step )
45+ # step = TestStepResult(name=title, start=now(), parameters=parameters)
46+ # self.allure_logger.start_step(None, uuid, step)
4147
4248 @allure_commons .hookimpl
4349 def stop_step (self , uuid , exc_type , exc_val , exc_tb ):
@@ -241,6 +247,12 @@ def add_description_html(self, test_description_html):
241247 if test_result :
242248 test_result .descriptionHtml = test_description_html
243249
250+ @allure_commons .hookimpl
251+ def add_thrd (self , test_description_html ):
252+ test_result = self .allure_logger .get_test (None )
253+ if test_result :
254+ test_result .descriptionHtml = test_description_html
255+
244256 @allure_commons .hookimpl
245257 def add_link (self , url , link_type , name ):
246258 test_result = self .allure_logger .get_test (None )
0 commit comments