Skip to content

test: Restore wrapped functions in functions_to_trace tests - #6933

Merged
alexander-alderman-webb merged 1 commit into
masterfrom
webb/flaky-test
Jul 29, 2026
Merged

test: Restore wrapped functions in functions_to_trace tests#6933
alexander-alderman-webb merged 1 commit into
masterfrom
webb/flaky-test

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

Remove the global patch after the span has finished in a finally block.

Based on the flake below

https://github.com/getsentry/sentry-python/actions/runs/30455774959/job/90588843197

with console output

FAILED tests/tracing/test_decorator.py::test_trace_decorator_no_trx - AssertionError: Expected 'mock' to be called once. Called 3 times.
Calls: [call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'test_decorator.my_example_function'),
 call('[Monitor] health check negative, downsampling with a factor of %d', 10),
 call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep')].

it looks like time.sleep is wrapped with start_span().

Issues

Reminders

@alexander-alderman-webb alexander-alderman-webb changed the title test: Restore wrapped functions in functions_to_trace tests test: Restore wrapped functions in functions_to_trace tests Jul 29, 2026
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review July 29, 2026 13:59
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner July 29, 2026 13:59
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

98542 passed | ⏭️ 6772 skipped | Total: 105314 | Pass Rate: 93.57% | Execution Time: 355m 32s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2499 uncovered lines.
✅ Project coverage is 89.84%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.84%    89.84%        —%
==========================================
  Files          193       193         —
  Lines        24587     24587         —
  Branches      8744      8744         —
==========================================
+ Hits         22088     22088         —
- Misses        2499      2499         —
- Partials      1400      1400         —

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb merged commit 86308d4 into master Jul 29, 2026
271 of 273 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/flaky-test branch July 29, 2026 14:33
mgaligniana pushed a commit to mgaligniana/sentry-python that referenced this pull request Aug 9, 2026
…try#6933)

Unwrap functions traced with `functions_to_trace` after the relevant span has finished in a finally block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants