Skip to content

Commit ed040a1

Browse files
committed
remove couple of tests
1 parent a8823a9 commit ed040a1

File tree

2 files changed

+0
-100
lines changed

2 files changed

+0
-100
lines changed

tests/test_client.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,34 +1801,6 @@ async def test_flush_async_no_transport():
18011801
await client.flush_async()
18021802

18031803

1804-
@skip_under_gevent
1805-
@pytest.mark.asyncio
1806-
@pytest.mark.skipif(not PY38, reason="Async client methods require Python 3.8+")
1807-
async def test_flush_async_awaits_flush_task():
1808-
"""Test flush_async() awaits the flush task returned by transport."""
1809-
client = Client(
1810-
"https://foo@sentry.io/123",
1811-
_experiments={"transport_async": True},
1812-
integrations=[AsyncioIntegration()],
1813-
)
1814-
assert isinstance(client.transport, AsyncHttpTransport)
1815-
1816-
flush_awaited = []
1817-
1818-
async def mock_wait_flush(timeout, callback=None):
1819-
flush_awaited.append(True)
1820-
1821-
import asyncio
1822-
1823-
mock_task = asyncio.create_task(mock_wait_flush(1.0))
1824-
1825-
with mock.patch.object(client.transport, "flush", return_value=mock_task):
1826-
await client.flush_async(timeout=1.0)
1827-
1828-
assert flush_awaited == [True]
1829-
await client.close_async()
1830-
1831-
18321804
@skip_under_gevent
18331805
@pytest.mark.asyncio
18341806
@pytest.mark.skipif(not PY38, reason="Async client methods require Python 3.8+")

tests/test_transport.py

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import socket
55
import sys
66
import asyncio
7-
import threading
87
from collections import defaultdict
98
from datetime import datetime, timedelta, timezone
109
from unittest import mock
@@ -879,41 +878,6 @@ def test_record_lost_event_transaction_item(capturing_server, make_client, span_
879878
} in discarded_events
880879

881880

882-
def test_handle_unexpected_status_invokes_handle_request_error(
883-
make_client, monkeypatch
884-
):
885-
client = make_client()
886-
transport = client.transport
887-
888-
monkeypatch.setattr(transport._worker, "submit", lambda fn: fn() or True)
889-
890-
def stub_request(method, endpoint, body=None, headers=None):
891-
class MockResponse:
892-
def __init__(self):
893-
self.status = 500 # Integer
894-
self.data = b"server error"
895-
self.headers = {}
896-
897-
def close(self):
898-
pass
899-
900-
return MockResponse()
901-
902-
monkeypatch.setattr(transport, "_request", stub_request)
903-
904-
seen = []
905-
monkeypatch.setattr(
906-
transport,
907-
"_handle_request_error",
908-
lambda envelope, loss_reason: seen.append(loss_reason),
909-
)
910-
911-
client.capture_event({"message": "test"})
912-
client.flush()
913-
914-
assert seen == ["status_500"]
915-
916-
917881
@skip_under_gevent
918882
@pytest.mark.asyncio
919883
@pytest.mark.parametrize("debug", (True, False))
@@ -996,42 +960,6 @@ async def test_transport_works_async(
996960
await client.close_async(timeout=2.0)
997961

998962

999-
@skip_under_gevent
1000-
@pytest.mark.asyncio
1001-
@pytest.mark.skipif(not PY38, reason="Async transport requires Python 3.8+")
1002-
async def test_async_transport_background_thread_capture(
1003-
capturing_server, make_client, caplog
1004-
):
1005-
"""Test capture_envelope from background threads uses run_coroutine_threadsafe"""
1006-
caplog.set_level(logging.DEBUG)
1007-
client = make_client(
1008-
_experiments={"transport_async": True}, integrations=[AsyncioIntegration()]
1009-
)
1010-
assert isinstance(client.transport, AsyncHttpTransport)
1011-
sentry_sdk.get_global_scope().set_client(client)
1012-
try:
1013-
captured_from_thread = []
1014-
exception_from_thread = []
1015-
1016-
def background_thread_work():
1017-
try:
1018-
# This should use run_coroutine_threadsafe path
1019-
capture_message("from background thread")
1020-
captured_from_thread.append(True)
1021-
except Exception as e:
1022-
exception_from_thread.append(e)
1023-
1024-
thread = threading.Thread(target=background_thread_work)
1025-
thread.start()
1026-
thread.join()
1027-
assert not exception_from_thread
1028-
assert captured_from_thread
1029-
await client.close_async(timeout=2.0)
1030-
assert capturing_server.captured
1031-
finally:
1032-
sentry_sdk.get_global_scope().set_client(None)
1033-
1034-
1035963
@skip_under_gevent
1036964
@pytest.mark.asyncio
1037965
@pytest.mark.skipif(not PY38, reason="Async transport requires Python 3.8+")

0 commit comments

Comments
 (0)