Skip to content

Commit

Permalink
Integrations added to enabled list if actually installed
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Nov 13, 2023
1 parent 069b6e9 commit b039d84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 148 in sentry_sdk/integrations/__init__.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/integrations/__init__.py#L148

Added line #L148 was not covered by tests

integrations = {
identifier: integration
for identifier, integration in iteritems(integrations)
if identifier in _installed_integrations
}

for identifier in integrations:
logger.debug("Enabling integration %s", identifier)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b039d84

Please sign in to comment.