File tree 1 file changed +8
-0
lines changed
opentelemetry-sdk/tests/trace
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 15
15
# pylint: disable=too-many-lines
16
16
import shutil
17
17
import subprocess
18
+ import sys
18
19
import unittest
19
20
from importlib import reload
20
21
from logging import ERROR , WARNING
@@ -1186,6 +1187,13 @@ def test_record_exception_context_manager(self):
1186
1187
stacktrace = """in test_record_exception_context_manager
1187
1188
raise RuntimeError("example error")
1188
1189
RuntimeError: example error"""
1190
+ if sys .version_info >= (3 , 11 ):
1191
+ # https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-error-locations-in-tracebacks
1192
+ tracelines = stacktrace .splitlines ()
1193
+ tracelines .insert (
1194
+ - 1 , " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
1195
+ )
1196
+ stacktrace = "\n " .join (tracelines )
1189
1197
self .assertIn (stacktrace , event .attributes ["exception.stacktrace" ])
1190
1198
1191
1199
try :
You can’t perform that action at this time.
0 commit comments