-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also, add deprecation warnings for `HttpTransport.hub_cls`. Fixes #3232
- Loading branch information
1 parent
defb448
commit 31efa62
Showing
2 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import gzip | ||
import io | ||
import socket | ||
from collections import namedtuple | ||
from collections import defaultdict, namedtuple | ||
from datetime import datetime, timedelta, timezone | ||
from unittest import mock | ||
|
||
|
@@ -17,7 +17,6 @@ | |
from sentry_sdk.transport import KEEP_ALIVE_SOCKET_OPTIONS, _parse_rate_limits | ||
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger | ||
|
||
|
||
CapturedData = namedtuple("CapturedData", ["path", "event", "envelope", "compressed"]) | ||
|
||
|
||
|
@@ -585,3 +584,21 @@ def test_metric_bucket_limits_with_all_namespaces( | |
assert report["discarded_events"] == [ | ||
{"category": "metric_bucket", "reason": "ratelimit_backoff", "quantity": 1}, | ||
] | ||
|
||
|
||
def test_hub_cls_backwards_compat(): | ||
class TestCustomHubClass(sentry_sdk.Hub): | ||
pass | ||
|
||
transport = sentry_sdk.transport.HttpTransport( | ||
defaultdict(lambda: None, {"dsn": "https://[email protected]/123"}) | ||
) | ||
|
||
with pytest.deprecated_call(): | ||
assert transport.hub_cls is sentry_sdk.Hub | ||
|
||
with pytest.deprecated_call(): | ||
transport.hub_cls = TestCustomHubClass | ||
|
||
with pytest.deprecated_call(): | ||
assert transport.hub_cls is TestCustomHubClass |