diff --git a/sentry_sdk/integrations/__init__.py b/sentry_sdk/integrations/__init__.py index 0fe958d217..38af2e7bdb 100644 --- a/sentry_sdk/integrations/__init__.py +++ b/sentry_sdk/integrations/__init__.py @@ -144,8 +144,14 @@ def setup_integrations( logger.debug( "Did not enable default integration %s: %s", identifier, e ) - - _installed_integrations.add(identifier) + else: + _installed_integrations.add(identifier) + + integrations = { + identifier: integration + for identifier, integration in iteritems(integrations) + if identifier in _installed_integrations + } for identifier in integrations: logger.debug("Enabling integration %s", identifier) diff --git a/tests/test_basics.py b/tests/test_basics.py index b2b8846eb9..5a7be44a8e 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -59,8 +59,8 @@ def test_auto_enabling_integrations_catches_import_error(sentry_init, caplog): sentry_init(auto_enabling_integrations=True, debug=True) for import_string in _AUTO_ENABLING_INTEGRATIONS: - # Ignore redis in the test case, because it is installed as a - # dependency for running tests, and therefore always enabled. + # Ignore redis in the test case, because it does not raise a DidNotEnable + # exception on import; rather, it raises the exception upon enabling. if _AUTO_ENABLING_INTEGRATIONS[redis_index] == import_string: continue