Skip to content

Commit

Permalink
Fix flaky transport test (#3666)
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana authored Oct 17, 2024
1 parent 9ae5820 commit 365d9cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions sentry_sdk/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


PY37 = sys.version_info[0] == 3 and sys.version_info[1] >= 7
PY38 = sys.version_info[0] == 3 and sys.version_info[1] >= 8
PY310 = sys.version_info[0] == 3 and sys.version_info[1] >= 10
PY311 = sys.version_info[0] == 3 and sys.version_info[1] >= 11

Expand Down
15 changes: 13 additions & 2 deletions tests/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
from pytest_localserver.http import WSGIServer
from werkzeug.wrappers import Request, Response

try:
import gevent
except ImportError:
gevent = None

import sentry_sdk
from sentry_sdk import (
Client,
Expand All @@ -23,6 +28,7 @@
get_isolation_scope,
Hub,
)
from sentry_sdk._compat import PY37, PY38
from sentry_sdk.envelope import Envelope, Item, parse_json
from sentry_sdk.transport import (
KEEP_ALIVE_SOCKET_OPTIONS,
Expand Down Expand Up @@ -123,10 +129,15 @@ def mock_transaction_envelope(span_count):
@pytest.mark.parametrize("client_flush_method", ["close", "flush"])
@pytest.mark.parametrize("use_pickle", (True, False))
@pytest.mark.parametrize("compression_level", (0, 9, None))
@pytest.mark.parametrize("compression_algo", ("gzip", "br", "<invalid>", None))
@pytest.mark.parametrize(
"http2", [True, False] if sys.version_info >= (3, 8) else [False]
"compression_algo",
(
("gzip", "br", "<invalid>", None)
if PY37 or gevent is None
else ("gzip", "<invalid>", None)
),
)
@pytest.mark.parametrize("http2", [True, False] if PY38 else [False])
def test_transport_works(
capturing_server,
request,
Expand Down

0 comments on commit 365d9cf

Please sign in to comment.