Skip to content

Commit b039d84

Browse files
Integrations added to enabled list if actually installed
1 parent 069b6e9 commit b039d84

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

sentry_sdk/integrations/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,14 @@ def setup_integrations(
144144
logger.debug(
145145
"Did not enable default integration %s: %s", identifier, e
146146
)
147-
148-
_installed_integrations.add(identifier)
147+
else:
148+
_installed_integrations.add(identifier)
149+
150+
integrations = {
151+
identifier: integration
152+
for identifier, integration in iteritems(integrations)
153+
if identifier in _installed_integrations
154+
}
149155

150156
for identifier in integrations:
151157
logger.debug("Enabling integration %s", identifier)

tests/test_basics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def test_auto_enabling_integrations_catches_import_error(sentry_init, caplog):
5959
sentry_init(auto_enabling_integrations=True, debug=True)
6060

6161
for import_string in _AUTO_ENABLING_INTEGRATIONS:
62-
# Ignore redis in the test case, because it is installed as a
63-
# dependency for running tests, and therefore always enabled.
62+
# Ignore redis in the test case, because it does not raise a DidNotEnable
63+
# exception on import; rather, it raises the exception upon enabling.
6464
if _AUTO_ENABLING_INTEGRATIONS[redis_index] == import_string:
6565
continue
6666

0 commit comments

Comments
 (0)