Skip to content

Commit 12d760e

Browse files
committed
tests: Remove unused fixtures
1 parent 22cf597 commit 12d760e

42 files changed

Lines changed: 47 additions & 199 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tests/conftest.py‎

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import socket
77
import threading
8-
import warnings
98
from collections import namedtuple
109
from dataclasses import dataclass
1110
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -42,11 +41,6 @@
4241
except (ImportError, RuntimeError):
4342
TestClient = None
4443

45-
try:
46-
import gevent
47-
except ImportError:
48-
gevent = None
49-
5044
import sentry_sdk
5145
import sentry_sdk.utils
5246
from sentry_sdk.envelope import Envelope, parse_json
@@ -489,37 +483,6 @@ def record_lost_event(reason, data_category=None, item=None, *, quantity=1):
489483
return inner
490484

491485

492-
@pytest.fixture
493-
def capture_events_forksafe(monkeypatch, capture_events, request):
494-
def inner():
495-
capture_events()
496-
497-
events_r, events_w = os.pipe()
498-
events_r = os.fdopen(events_r, "rb", 0)
499-
events_w = os.fdopen(events_w, "wb", 0)
500-
501-
test_client = sentry_sdk.get_client()
502-
503-
old_capture_envelope = test_client.transport.capture_envelope
504-
505-
def append(envelope):
506-
event = envelope.get_event()
507-
if event is not None:
508-
events_w.write(json.dumps(event).encode("utf-8"))
509-
events_w.write(b"\n")
510-
return old_capture_envelope(envelope)
511-
512-
def flush(timeout=None, callback=None):
513-
events_w.write(b"flush\n")
514-
515-
monkeypatch.setattr(test_client.transport, "capture_envelope", append)
516-
monkeypatch.setattr(test_client, "flush", flush)
517-
518-
return EventStreamReader(events_r, events_w)
519-
520-
return inner
521-
522-
523486
@pytest.fixture
524487
def capture_items_forksafe(monkeypatch, capture_items, request):
525488
def inner(*types):
@@ -578,29 +541,6 @@ def read_flush(self):
578541
assert self.read_file.readline() == b"flush\n"
579542

580543

581-
# scope=session ensures that fixture is run earlier
582-
@pytest.fixture(
583-
scope="session",
584-
params=[None, "gevent"],
585-
ids=("threads", "greenlet"),
586-
)
587-
def maybe_monkeypatched_threading(request):
588-
if request.param == "gevent":
589-
if gevent is None:
590-
pytest.skip("no gevent installed")
591-
try:
592-
gevent.monkey.patch_all()
593-
except Exception as e:
594-
if "_RLock__owner" in str(e):
595-
pytest.skip("https://github.com/gevent/gevent/issues/1380")
596-
else:
597-
raise
598-
else:
599-
assert request.param is None
600-
601-
return request.param
602-
603-
604544
@pytest.fixture
605545
def render_span_tree():
606546
def inner(spans):
@@ -815,17 +755,6 @@ def teardown_profiling():
815755
teardown_continuous_profiler()
816756

817757

818-
@pytest.fixture()
819-
def suppress_deprecation_warnings():
820-
"""
821-
Use this fixture to suppress deprecation warnings in a test.
822-
Useful for testing deprecated SDK features.
823-
"""
824-
with warnings.catch_warnings():
825-
warnings.simplefilter("ignore", DeprecationWarning)
826-
yield
827-
828-
829758
def _make_session_message(jsonrpc_msg):
830759
"""Construct a SessionMessage compatible with both MCP v1 and v2."""
831760
if _IS_MCP_V2:

‎tests/integrations/asgi/test_asgi.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ async def test_websocket(
401401
sentry_init,
402402
asgi3_ws_app,
403403
capture_items,
404-
request,
405404
):
406405
sentry_init(
407406
data_collection={},

‎tests/integrations/asyncio/test_asyncio.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ async def test_delayed_enable_integration(
511511

512512
@minimum_python_38
513513
@pytest.mark.asyncio
514-
async def test_delayed_enable_integration_with_options(sentry_init, capture_events):
514+
async def test_delayed_enable_integration_with_options(sentry_init):
515515
sentry_init(
516516
traces_sample_rate=1.0,
517517
data_collection={},

‎tests/integrations/beam/test_beam.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def test_invoker_normal(init_beam, fn):
200200

201201

202202
@pytest.mark.parametrize("fn", [test_simple, test_callable, test_place_holder])
203-
def test_invoker_exception(init_beam, capture_events, capture_exceptions, fn):
203+
def test_invoker_exception(init_beam, capture_events, fn):
204204
invoker = init_beam(fn)
205205
events = capture_events()
206206

‎tests/integrations/bottle/test_bottle.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def index():
343343
assert len(events) == 1
344344

345345

346-
def test_mount(app, capture_exceptions, capture_events, sentry_init, get_client):
346+
def test_mount(app, capture_exceptions, capture_events, sentry_init):
347347
sentry_init(integrations=[BottleIntegration()])
348348

349349
app.catchall = False
@@ -437,7 +437,6 @@ def here():
437437
def test_span_origin(
438438
sentry_init,
439439
get_client,
440-
capture_events,
441440
capture_items,
442441
):
443442
sentry_init(

‎tests/integrations/celery/test_celery.py‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515
from sentry_sdk.integrations.celery.beat import _get_headers
1616

1717

18-
@pytest.fixture
19-
def connect_signal(request):
20-
def inner(signal, f):
21-
signal.connect(f)
22-
request.addfinalizer(lambda: signal.disconnect(f))
23-
24-
return inner
25-
26-
2718
@pytest.fixture
2819
def init_celery(sentry_init, request):
2920
def inner(
@@ -53,7 +44,6 @@ def inner(
5344
if VERSION < (4,):
5445
pytest.skip("Redis backend broken for some reason")
5546

56-
# this backend requires capture_events_forksafe
5747
celery.conf.worker_max_tasks_per_child = 1
5848
celery.conf.worker_concurrency = 1
5949
redis_url = f"redis://{os.environ.get('SENTRY_PYTHON_TEST_REDIS_HOST', '127.0.0.1')}:6379"

‎tests/integrations/clickhouse_driver/test_clickhouse_driver.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None:
750750
def test_clickhouse_dbapi_spans(
751751
sentry_init,
752752
capture_items,
753-
capture_envelopes,
754753
):
755754
sentry_init(
756755
integrations=[ClickhouseDriverIntegration()],
@@ -878,7 +877,7 @@ def test_clickhouse_dbapi_spans(
878877
assert spans == expected_spans
879878

880879

881-
def test_span_origin(sentry_init, capture_items, capture_envelopes):
880+
def test_span_origin(sentry_init, capture_items):
882881
sentry_init(
883882
integrations=[ClickhouseDriverIntegration()],
884883
traces_sample_rate=1.0,

‎tests/integrations/dramatiq/test_dramatiq.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def dummy_actor(x, y):
110110
def test_task_transaction(
111111
broker,
112112
worker,
113-
capture_events,
114113
capture_items,
115114
expected_span_status,
116115
fail_fast,

‎tests/integrations/flask/test_flask.py‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def test_has_context(sentry_init, app, capture_events):
108108
def test_segment_name_and_source(
109109
sentry_init,
110110
app,
111-
capture_events,
112111
capture_items,
113112
url,
114113
expected_transaction,
@@ -209,7 +208,7 @@ def test_flask_login_not_installed(
209208

210209

211210
def test_flask_login_not_configured(
212-
sentry_init, app, capture_events, monkeypatch, integration_enabled_params
211+
sentry_init, app, capture_events, integration_enabled_params
213212
):
214213
sentry_init(data_collection={"user_info": False}, **integration_enabled_params)
215214

@@ -227,7 +226,7 @@ def test_flask_login_not_configured(
227226

228227

229228
def test_flask_login_partially_configured(
230-
sentry_init, app, capture_events, monkeypatch, integration_enabled_params
229+
sentry_init, app, capture_events, integration_enabled_params
231230
):
232231
sentry_init(data_collection={"user_info": False}, **integration_enabled_params)
233232

@@ -257,9 +256,7 @@ def test_flask_login_configured(
257256
sentry_init,
258257
app,
259258
user_id,
260-
capture_events,
261259
capture_items,
262-
monkeypatch,
263260
integration_enabled_params,
264261
):
265262
sentry_init(
@@ -801,7 +798,6 @@ def zerodivision(e):
801798

802799
def test_tracing_success(
803800
sentry_init,
804-
capture_events,
805801
capture_items,
806802
app,
807803
):
@@ -847,7 +843,7 @@ def hi_tx():
847843
assert message_event["tags"]["before_request"] == "yes"
848844

849845

850-
def test_tracing_error(sentry_init, capture_events, capture_items, app):
846+
def test_tracing_error(sentry_init, capture_items, app):
851847
sentry_init(
852848
data_collection={},
853849
traces_sample_rate=1.0,
@@ -1011,7 +1007,7 @@ def index():
10111007
assert event["request"]["headers"]["Proxy-Authorization"] == "[Filtered]"
10121008

10131009

1014-
def test_span_origin(sentry_init, app, capture_events, capture_items):
1010+
def test_span_origin(sentry_init, app, capture_items):
10151011
sentry_init(
10161012
data_collection={},
10171013
integrations=[flask_sentry.FlaskIntegration()],
@@ -1034,7 +1030,6 @@ def test_span_origin(sentry_init, app, capture_events, capture_items):
10341030
def test_segment_http_method_default(
10351031
sentry_init,
10361032
app,
1037-
capture_events,
10381033
capture_items,
10391034
):
10401035
"""
@@ -1069,7 +1064,6 @@ def test_segment_http_method_default(
10691064
def test_segment_http_method_custom(
10701065
sentry_init,
10711066
app,
1072-
capture_events,
10731067
capture_items,
10741068
):
10751069
"""

‎tests/integrations/langchain/test_langchain.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,6 @@ def test_transform_list_with_legacy_image_url(self):
29982998
)
29992999
def test_langchain_chat_data_collection(
30003000
sentry_init,
3001-
capture_events,
30023001
capture_items,
30033002
get_model_response,
30043003
nonstreaming_chat_completions_model_response,
@@ -3106,7 +3105,6 @@ def test_langchain_chat_data_collection(
31063105
)
31073106
def test_langchain_text_completion_data_collection(
31083107
sentry_init,
3109-
capture_events,
31103108
capture_items,
31113109
get_model_response,
31123110
data_collection,
@@ -3210,7 +3208,6 @@ def test_langchain_text_completion_data_collection(
32103208
)
32113209
def test_langchain_data_collection_tools(
32123210
sentry_init,
3213-
capture_events,
32143211
capture_items,
32153212
get_model_response,
32163213
server_side_event_chunks,
@@ -3310,7 +3307,6 @@ def test_langchain_data_collection_tools(
33103307
)
33113308
def test_langchain_data_collection_request_tool_call_params(
33123309
sentry_init,
3313-
capture_events,
33143310
capture_items,
33153311
data_collection,
33163312
tool_calls_collected,
@@ -3378,7 +3374,6 @@ def test_langchain_data_collection_request_tool_call_params(
33783374
)
33793375
def test_langchain_tool_execution_data_collection(
33803376
sentry_init,
3381-
capture_events,
33823377
capture_items,
33833378
get_model_response,
33843379
server_side_event_chunks,
@@ -3476,7 +3471,6 @@ def test_langchain_tool_execution_data_collection(
34763471
)
34773472
def test_langchain_agent_executor_data_collection(
34783473
sentry_init,
3479-
capture_events,
34803474
capture_items,
34813475
get_model_response,
34823476
server_side_event_chunks,

0 commit comments

Comments
 (0)