Registry / testing / pytest-sentry

pytest-sentry

JSON →
library0.5.1pypypi✓ verified 86d ago

A pytest plugin to send test run information to Sentry.io. Currently at version 0.5.1, with irregular releases. Compatible with Sentry SDK >=3.0 (since 0.4.0).

pip install pytest-sentry
INSTALL
IMPORT
SIG · PYTEST-SENTRY
P
pytest-sentry
testingpythonv0.5.1
Install
4.1s avg
Import
949ms
Disk
39MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.988s · 39.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.1s · import 0.910s · 40MB
39MB installed
● package 39MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_sentry
import pytest_sentry
Plugin auto-loads as pytest plugin; explicit import only needed for advanced usage.

Basic setup: set SENTRY_DSN environment variable and the plugin will automatically capture test failures and performance data.

# conftest.py import pytest_sentry SENTRY_DSN = os.environ.get('SENTRY_DSN', '') @pytest.fixture(autouse=True) def sentry_test_hub(): pytest_sentry.hub.init(dsn=SENTRY_DSN) yield
Debug
Known issues
breakingVersion 0.4.0+ requires sentry-sdk >=3.0. Older sentry-sdk versions will break.
fix
Upgrade sentry-sdk to >=3.0.0: pip install -U sentry-sdk
affects: >=0.4.0
breakingVersion 0.3.x requires sentry-sdk >=2.0. sentry-sdk<2.0 will break.
fix
Use pytest-sentry 0.1.16 with sentry-sdk <2.0, or upgrade sentry-sdk.
affects: 0.3.0 - 0.3.3
deprecatedThe 'hub' object is deprecated in favor of direct Sentry SDK usage. Consider using sentry_sdk directly.
fix
Replace pytest_sentry.hub with sentry_sdk: 'import sentry_sdk; sentry_sdk.init(...)'
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'hub' from 'pytest_sentry'
pytest_sentry.hub was removed in newer versions; use sentry_sdk directly.
fix
Use 'import sentry_sdk; sentry_sdk.init()' instead of 'pytest_sentry.hub.init()'.
Sentry could not send events: You need a DSN to send events (DSN not set)
SENTRY_DSN environment variable is not set or empty.
fix
Set environment variable SENTRY_DSN or pass it via pytest ini option: '--sentry-dsn=...'
TypeError: Client.__init__() got an unexpected keyword argument 'integrations'
Mismatched sentry-sdk version; sentry-sdk <2.0 does not support certain arguments used by pytest-sentry >=0.3.0.
fix
Upgrade sentry-sdk to >=2.0.0 (or >=3.0.0 for pytest-sentry >=0.4.0).
Upgrade
Version history
0.5.1latest on PyPI · released Jul 1, 2025
Audit
Dependencies
sentry-sdkrequiredRequired; versions >=3.0 (pytest-sentry >=0.4.0) or >=2.0 (pytest-sentry 0.3.x) or base SDK (older releases)
Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
2
Amazon
1
Resources
pytest-sentry — pip install pytest-sentry · libregistry