File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
opentelemetry-sdk/tests/logs Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -182,20 +182,20 @@ def test_log_record_exception(self):
182182
183183 def test_log_record_recursive_exception (self ):
184184 """Exception information will be included in attributes even though it is recursive"""
185- processor , logger = set_up_test_logging (logging .ERROR )
185+ with set_up_test_logging (logging .ERROR ) as ( processor , logger ):
186186
187- try :
188- raise ZeroDivisionError (
189- ZeroDivisionError (ZeroDivisionError ("division by zero" ))
190- )
191- except ZeroDivisionError :
192- with self .assertLogs (level = logging .ERROR ):
193- logger .exception ("Zero Division Error" )
187+ try :
188+ raise ZeroDivisionError (
189+ ZeroDivisionError (ZeroDivisionError ("division by zero" ))
190+ )
191+ except ZeroDivisionError :
192+ with self .assertLogs (level = logging .ERROR ):
193+ logger .exception ("Zero Division Error" )
194194
195195 log_record = processor .get_log_record (0 )
196196
197197 self .assertIsNotNone (log_record )
198- self .assertEqual ( log_record . body , "Zero Division Error" )
198+ self .assertIn ( "Zero Division Error" , log_record . body )
199199 self .assertEqual (
200200 log_record .attributes [SpanAttributes .EXCEPTION_TYPE ],
201201 ZeroDivisionError .__name__ ,
You can’t perform that action at this time.
0 commit comments