@@ -73,7 +73,9 @@ def pytest_runtest_protocol(self, item, nextitem):
7373 yield
7474
7575 for name , value in item .callspec .params .items () if hasattr (item , 'callspec' ) else ():
76- self .allure_logger .update_test (uuid , parameters = Parameter (name , represent (value )))
76+ test_result = self .allure_logger .get_test (uuid )
77+ if test_result :
78+ test_result .parameters .append (Parameter (name , represent (value )))
7779
7880 test_case .labels .extend ([Label (name = name , value = value ) for name , value in allure_labels (item )])
7981 test_case .labels .extend ([Label (name = LabelType .TAG , value = value ) for value in pytest_markers (item )])
@@ -94,11 +96,14 @@ def pytest_runtest_protocol(self, item, nextitem):
9496 @pytest .hookimpl (hookwrapper = True )
9597 def pytest_runtest_call (self , item ):
9698 uuid = self ._cache .get (item .nodeid )
97- self .allure_logger .update_test (uuid , start = now ())
99+ test_result = self .allure_logger .get_test (uuid )
100+ if test_result :
101+ test_result .start = now ()
98102
99103 yield
100104
101- self .allure_logger .update_test (uuid , stop = now ())
105+ if test_result :
106+ test_result .stop = now ()
102107
103108 @pytest .hookimpl (hookwrapper = True )
104109 def pytest_fixture_setup (self , fixturedef , request ):
@@ -170,10 +175,13 @@ def pytest_runtest_makereport(self, item, call):
170175 if report .failed and status == Status .PASSED :
171176 status = Status .BROKEN
172177
173- if status_details :
174- self .allure_logger .update_test (uuid , status = status , statusDetails = status_details )
175- else :
176- self .allure_logger .update_test (uuid , status = status )
178+ test_result = self .allure_logger .get_test (uuid )
179+ if test_result :
180+ if status_details :
181+ test_result .status = status
182+ test_result .statusDetails = status_details
183+ else :
184+ test_result .status = status
177185
178186 @allure_commons .hookimpl
179187 def attach_data (self , body , name , attachment_type , extension ):
@@ -185,12 +193,15 @@ def attach_file(self, source, name, attachment_type, extension):
185193
186194 @allure_commons .hookimpl
187195 def add_link (self , url , link_type , name ):
188- self .allure_logger .update_test (None , links = Link (link_type , url , name ))
196+ test_result = self .allure_logger .get_test (None )
197+ if test_result :
198+ test_result .links .append (Link (link_type , url , name ))
189199
190200 @allure_commons .hookimpl
191201 def add_label (self , label_type , labels ):
192- for label in labels :
193- self .allure_logger .update_test (None , labels = Label (label_type , label ))
202+ test_result = self .allure_logger .get_test (None )
203+ for label in labels if test_result else ():
204+ test_result .labels .append (Label (label_type , label ))
194205
195206
196207class ItemCache (object ):
0 commit comments