Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix flaky test_custom_traceback_size_with_error on Python 3.13 #11858

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading