Skip to content

Disable Sentry in tests#159

Open
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/disable-sentry-in-tests
Open

Disable Sentry in tests#159
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/disable-sentry-in-tests

Conversation

@mendral-app

@mendral-app mendral-app Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add _is_test_environment() guard in init_sentry() that detects pytest execution (via PYTEST_CURRENT_TEST env var or pytest in sys.modules) and skips Sentry initialization entirely
  • Eliminates noise from test-generated exceptions (e.g. MagicMock errors) being reported to the production Sentry project

Resolves: Test errors leaking to Sentry production


Note

Created by Mendral. Tag @mendral-app with feedback or questions.

Add _is_test_environment() guard in init_sentry() that checks for
PYTEST_CURRENT_TEST env var or pytest in sys.modules. This prevents
test runs from reporting mock-derived exceptions to the production
Sentry project.
@mendral-app mendral-app Bot requested a review from a team June 10, 2026 19:51
@mendral-app mendral-app Bot marked this pull request as ready for review June 10, 2026 19:59
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.

0 participants