Skip to content

test: Initialize SDK in relevant tests#758

Closed
alexander-alderman-webb wants to merge 12 commits into
mainfrom
webb/add-init-to-tests
Closed

test: Initialize SDK in relevant tests#758
alexander-alderman-webb wants to merge 12 commits into
mainfrom
webb/add-init-to-tests

Conversation

@alexander-alderman-webb

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

Copy link
Copy Markdown
Contributor

Initialize the SDK with a mock transport in tests in which _execute_activation or create_activation is called, since the functions rely on tracing functions. The SDK was previously uninitialized in tests.
The initialization fixture is adapted from https://github.com/getsentry/sentry-python.

This allows us to exercise options that change the tracing behavior in tests. The tests are parametrized on the trace lifecycle in a follow up PR (#757).

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review July 21, 2026 13:12
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner July 21, 2026 13:12
Comment thread clients/python/tests/conftest.py Outdated
Comment thread clients/python/tests/conftest.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 265e126. Configure here.

Comment thread clients/python/tests/worker/test_worker.py
Comment thread clients/python/tests/conftest.py Outdated
@evanh

evanh commented Jul 21, 2026

Copy link
Copy Markdown
Member

since the function relies on tracing functions

I don't like the idea that our main execution is reliant on the Sentry SDK. Is there a way to structure this so we capture the information but don't fail if the sentry SDK functions fail?

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor Author

Of course, you don't want your program to also fail if your observability fails.
As much as we try to not crash in the SDK, it can and has occurred, especially as we're transitioning to span streaming and dogfooding.
I'd wrap SDK function calls in try...except blocks. I think that's the way to go, particularly in something like taskbroker. If that sounds good I can do that tomorrow. Created #761 to track (or if someone else takes it, feel free to un-assign me).

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor Author

Closing as we've discussed in person in VIE that we'll keep the tests in the SDK and continue relying on the no-op client that exists when the SDK is not initialized in taskbroker tests.

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.

2 participants