Skip to content

Commit

Permalink
ci: fix flaky test_custom_traceback_size_with_error on Python 3.13 (#…
Browse files Browse the repository at this point in the history
…11858)

(cherry picked from commit 6620f9b)
  • Loading branch information
brettlangdon authored and github-actions[bot] committed Jan 13, 2025
1 parent 8d79908 commit 816034a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/tracer/test_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,16 @@ def wrapper():
assert 0, "should have failed"

stack = s.get_tag(ERROR_STACK)
assert stack, "No error stack collected"
# one header "Traceback (most recent call last):" and one footer "ZeroDivisionError: division by zero"
header_and_footer_lines = 2
# Python 3.13 adds extra lines to the traceback:
# File dd-trace-py/tests/tracer/test_span.py", line 279, in test_custom_traceback_size_with_error
# wrapper()
# ~~~~~~~^^
multiplier = 3 if "~~" in stack else 2
assert (
len(stack.splitlines()) == tb_length_limit * 2 + header_and_footer_lines
len(stack.splitlines()) == tb_length_limit * multiplier + header_and_footer_lines
), "stacktrace should contain two lines per entry"

def test_ctx_mgr(self):
Expand Down

0 comments on commit 816034a

Please sign in to comment.