Skip to content

Commit

Permalink
Move test to test_basics
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Nov 18, 2023
1 parent 1a63d0d commit dc86efe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
27 changes: 0 additions & 27 deletions tests/integrations/test_init.py

This file was deleted.

32 changes: 31 additions & 1 deletion tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
Hub,
)
from sentry_sdk._compat import reraise
from sentry_sdk.integrations import _AUTO_ENABLING_INTEGRATIONS
from sentry_sdk.integrations import (
_AUTO_ENABLING_INTEGRATIONS,
Integration,
setup_integrations,
)
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.scope import ( # noqa: F401
Expand All @@ -41,6 +45,24 @@ def _redis_installed(): # type: () -> bool
return True


class NoOpIntegration(Integration):
"""
A simple no-op integration for testing purposes.
"""

identifier = "noop"

@staticmethod
def setup_once(): # type: () -> None
pass

def __eq__(self, __value): # type: (object) -> bool
"""
All instances of NoOpIntegration should be considered equal to each other.
"""
return type(__value) == type(self)


def test_processors(sentry_init, capture_events):
sentry_init()
events = capture_events()
Expand Down Expand Up @@ -706,3 +728,11 @@ def test_redis_disabled_when_not_installed(sentry_init):
sentry_init()

assert Hub.current.get_integration(RedisIntegration) is None


def test_multiple_setup_integrations_calls():
first_call_return = setup_integrations([NoOpIntegration()], with_defaults=False)
assert first_call_return == {NoOpIntegration.identifier: NoOpIntegration()}

second_call_return = setup_integrations([NoOpIntegration()], with_defaults=False)
assert second_call_return == {NoOpIntegration.identifier: NoOpIntegration()}

0 comments on commit dc86efe

Please sign in to comment.