diff --git a/tests/conftest.py b/tests/conftest.py index ff63c8dc17..49a0fb6154 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,6 @@ import os import socket import threading -import warnings from collections import namedtuple from dataclasses import dataclass from http.server import BaseHTTPRequestHandler, HTTPServer @@ -42,11 +41,6 @@ except (ImportError, RuntimeError): TestClient = None -try: - import gevent -except ImportError: - gevent = None - import sentry_sdk import sentry_sdk.utils from sentry_sdk.envelope import Envelope, parse_json @@ -489,37 +483,6 @@ def record_lost_event(reason, data_category=None, item=None, *, quantity=1): return inner -@pytest.fixture -def capture_events_forksafe(monkeypatch, capture_events, request): - def inner(): - capture_events() - - events_r, events_w = os.pipe() - events_r = os.fdopen(events_r, "rb", 0) - events_w = os.fdopen(events_w, "wb", 0) - - test_client = sentry_sdk.get_client() - - old_capture_envelope = test_client.transport.capture_envelope - - def append(envelope): - event = envelope.get_event() - if event is not None: - events_w.write(json.dumps(event).encode("utf-8")) - events_w.write(b"\n") - return old_capture_envelope(envelope) - - def flush(timeout=None, callback=None): - events_w.write(b"flush\n") - - monkeypatch.setattr(test_client.transport, "capture_envelope", append) - monkeypatch.setattr(test_client, "flush", flush) - - return EventStreamReader(events_r, events_w) - - return inner - - @pytest.fixture def capture_items_forksafe(monkeypatch, capture_items, request): def inner(*types): @@ -578,29 +541,6 @@ def read_flush(self): assert self.read_file.readline() == b"flush\n" -# scope=session ensures that fixture is run earlier -@pytest.fixture( - scope="session", - params=[None, "gevent"], - ids=("threads", "greenlet"), -) -def maybe_monkeypatched_threading(request): - if request.param == "gevent": - if gevent is None: - pytest.skip("no gevent installed") - try: - gevent.monkey.patch_all() - except Exception as e: - if "_RLock__owner" in str(e): - pytest.skip("https://github.com/gevent/gevent/issues/1380") - else: - raise - else: - assert request.param is None - - return request.param - - @pytest.fixture def render_span_tree(): def inner(spans): @@ -815,17 +755,6 @@ def teardown_profiling(): teardown_continuous_profiler() -@pytest.fixture() -def suppress_deprecation_warnings(): - """ - Use this fixture to suppress deprecation warnings in a test. - Useful for testing deprecated SDK features. - """ - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - yield - - def _make_session_message(jsonrpc_msg): """Construct a SessionMessage compatible with both MCP v1 and v2.""" if _IS_MCP_V2: diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index 996c9e2eb7..80a84a0649 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -401,7 +401,6 @@ async def test_websocket( sentry_init, asgi3_ws_app, capture_items, - request, ): sentry_init( data_collection={}, diff --git a/tests/integrations/asyncio/test_asyncio.py b/tests/integrations/asyncio/test_asyncio.py index 6c53ccbfb6..e3a7e84521 100644 --- a/tests/integrations/asyncio/test_asyncio.py +++ b/tests/integrations/asyncio/test_asyncio.py @@ -511,7 +511,7 @@ async def test_delayed_enable_integration( @minimum_python_38 @pytest.mark.asyncio -async def test_delayed_enable_integration_with_options(sentry_init, capture_events): +async def test_delayed_enable_integration_with_options(sentry_init): sentry_init( traces_sample_rate=1.0, data_collection={}, diff --git a/tests/integrations/beam/test_beam.py b/tests/integrations/beam/test_beam.py index e80a67a107..1742ba0ba8 100644 --- a/tests/integrations/beam/test_beam.py +++ b/tests/integrations/beam/test_beam.py @@ -200,7 +200,7 @@ def test_invoker_normal(init_beam, fn): @pytest.mark.parametrize("fn", [test_simple, test_callable, test_place_holder]) -def test_invoker_exception(init_beam, capture_events, capture_exceptions, fn): +def test_invoker_exception(init_beam, capture_events, fn): invoker = init_beam(fn) events = capture_events() diff --git a/tests/integrations/bottle/test_bottle.py b/tests/integrations/bottle/test_bottle.py index 96475bd131..94877808da 100644 --- a/tests/integrations/bottle/test_bottle.py +++ b/tests/integrations/bottle/test_bottle.py @@ -343,7 +343,7 @@ def index(): assert len(events) == 1 -def test_mount(app, capture_exceptions, capture_events, sentry_init, get_client): +def test_mount(app, capture_exceptions, capture_events, sentry_init): sentry_init(integrations=[BottleIntegration()]) app.catchall = False @@ -437,7 +437,6 @@ def here(): def test_span_origin( sentry_init, get_client, - capture_events, capture_items, ): sentry_init( diff --git a/tests/integrations/celery/test_celery.py b/tests/integrations/celery/test_celery.py index b55186f71a..f7a8a23386 100644 --- a/tests/integrations/celery/test_celery.py +++ b/tests/integrations/celery/test_celery.py @@ -15,15 +15,6 @@ from sentry_sdk.integrations.celery.beat import _get_headers -@pytest.fixture -def connect_signal(request): - def inner(signal, f): - signal.connect(f) - request.addfinalizer(lambda: signal.disconnect(f)) - - return inner - - @pytest.fixture def init_celery(sentry_init, request): def inner( @@ -53,7 +44,6 @@ def inner( if VERSION < (4,): pytest.skip("Redis backend broken for some reason") - # this backend requires capture_events_forksafe celery.conf.worker_max_tasks_per_child = 1 celery.conf.worker_concurrency = 1 redis_url = f"redis://{os.environ.get('SENTRY_PYTHON_TEST_REDIS_HOST', '127.0.0.1')}:6379" diff --git a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py index 96a7371c74..ebfe990132 100644 --- a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py +++ b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py @@ -750,7 +750,6 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: def test_clickhouse_dbapi_spans( sentry_init, capture_items, - capture_envelopes, ): sentry_init( integrations=[ClickhouseDriverIntegration()], @@ -878,7 +877,7 @@ def test_clickhouse_dbapi_spans( assert spans == expected_spans -def test_span_origin(sentry_init, capture_items, capture_envelopes): +def test_span_origin(sentry_init, capture_items): sentry_init( integrations=[ClickhouseDriverIntegration()], traces_sample_rate=1.0, diff --git a/tests/integrations/dramatiq/test_dramatiq.py b/tests/integrations/dramatiq/test_dramatiq.py index 64917dcf60..7ea46957da 100644 --- a/tests/integrations/dramatiq/test_dramatiq.py +++ b/tests/integrations/dramatiq/test_dramatiq.py @@ -110,7 +110,6 @@ def dummy_actor(x, y): def test_task_transaction( broker, worker, - capture_events, capture_items, expected_span_status, fail_fast, diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index b9eced48a4..74eb129fb0 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -108,7 +108,6 @@ def test_has_context(sentry_init, app, capture_events): def test_segment_name_and_source( sentry_init, app, - capture_events, capture_items, url, expected_transaction, @@ -209,7 +208,7 @@ def test_flask_login_not_installed( def test_flask_login_not_configured( - sentry_init, app, capture_events, monkeypatch, integration_enabled_params + sentry_init, app, capture_events, integration_enabled_params ): sentry_init(data_collection={"user_info": False}, **integration_enabled_params) @@ -227,7 +226,7 @@ def test_flask_login_not_configured( def test_flask_login_partially_configured( - sentry_init, app, capture_events, monkeypatch, integration_enabled_params + sentry_init, app, capture_events, integration_enabled_params ): sentry_init(data_collection={"user_info": False}, **integration_enabled_params) @@ -257,9 +256,7 @@ def test_flask_login_configured( sentry_init, app, user_id, - capture_events, capture_items, - monkeypatch, integration_enabled_params, ): sentry_init( @@ -801,7 +798,6 @@ def zerodivision(e): def test_tracing_success( sentry_init, - capture_events, capture_items, app, ): @@ -847,7 +843,7 @@ def hi_tx(): assert message_event["tags"]["before_request"] == "yes" -def test_tracing_error(sentry_init, capture_events, capture_items, app): +def test_tracing_error(sentry_init, capture_items, app): sentry_init( data_collection={}, traces_sample_rate=1.0, @@ -1011,7 +1007,7 @@ def index(): assert event["request"]["headers"]["Proxy-Authorization"] == "[Filtered]" -def test_span_origin(sentry_init, app, capture_events, capture_items): +def test_span_origin(sentry_init, app, capture_items): sentry_init( data_collection={}, integrations=[flask_sentry.FlaskIntegration()], @@ -1034,7 +1030,6 @@ def test_span_origin(sentry_init, app, capture_events, capture_items): def test_segment_http_method_default( sentry_init, app, - capture_events, capture_items, ): """ @@ -1069,7 +1064,6 @@ def test_segment_http_method_default( def test_segment_http_method_custom( sentry_init, app, - capture_events, capture_items, ): """ diff --git a/tests/integrations/langchain/test_langchain.py b/tests/integrations/langchain/test_langchain.py index 08e502a0ab..834c7731e2 100644 --- a/tests/integrations/langchain/test_langchain.py +++ b/tests/integrations/langchain/test_langchain.py @@ -2998,7 +2998,6 @@ def test_transform_list_with_legacy_image_url(self): ) def test_langchain_chat_data_collection( sentry_init, - capture_events, capture_items, get_model_response, nonstreaming_chat_completions_model_response, @@ -3106,7 +3105,6 @@ def test_langchain_chat_data_collection( ) def test_langchain_text_completion_data_collection( sentry_init, - capture_events, capture_items, get_model_response, data_collection, @@ -3210,7 +3208,6 @@ def test_langchain_text_completion_data_collection( ) def test_langchain_data_collection_tools( sentry_init, - capture_events, capture_items, get_model_response, server_side_event_chunks, @@ -3310,7 +3307,6 @@ def test_langchain_data_collection_tools( ) def test_langchain_data_collection_request_tool_call_params( sentry_init, - capture_events, capture_items, data_collection, tool_calls_collected, @@ -3378,7 +3374,6 @@ def test_langchain_data_collection_request_tool_call_params( ) def test_langchain_tool_execution_data_collection( sentry_init, - capture_events, capture_items, get_model_response, server_side_event_chunks, @@ -3476,7 +3471,6 @@ def test_langchain_tool_execution_data_collection( ) def test_langchain_agent_executor_data_collection( sentry_init, - capture_events, capture_items, get_model_response, server_side_event_chunks, diff --git a/tests/integrations/launchdarkly/test_launchdarkly.py b/tests/integrations/launchdarkly/test_launchdarkly.py index 5a9048becc..9782eba940 100644 --- a/tests/integrations/launchdarkly/test_launchdarkly.py +++ b/tests/integrations/launchdarkly/test_launchdarkly.py @@ -188,7 +188,6 @@ def test_launchdarkly_integration_did_not_enable(uninstall_integration): def test_launchdarkly_span_integration( sentry_init, - capture_events, capture_items, uninstall_integration, ): diff --git a/tests/integrations/logging/test_logging.py b/tests/integrations/logging/test_logging.py index e86b529948..0c94fd7fe9 100644 --- a/tests/integrations/logging/test_logging.py +++ b/tests/integrations/logging/test_logging.py @@ -299,7 +299,7 @@ def test_event_logging_captured_warnings(sentry_init, capture_events, recwarn): assert len(third_warnings) == 1 -def test_sentry_logs_collection_off_by_default(sentry_init, capture_items, request): +def test_sentry_logs_collection_off_by_default(sentry_init, capture_items): """Automatic logs capture by Sentry logs needs explicit opt-in to the integration.""" sentry_init() items = capture_items("log") @@ -312,7 +312,7 @@ def test_sentry_logs_collection_off_by_default(sentry_init, capture_items, reque assert not items -def test_sentry_logs_collection_opt_in(sentry_init, capture_items, request): +def test_sentry_logs_collection_opt_in(sentry_init, capture_items): """Automatic logs capture by Sentry logs needs explicit opt-in to the integration.""" sentry_init(integrations=[LoggingIntegration()]) items = capture_items("log") diff --git a/tests/integrations/loguru/test_loguru.py b/tests/integrations/loguru/test_loguru.py index 0440c2fc1e..f10c2f9098 100644 --- a/tests/integrations/loguru/test_loguru.py +++ b/tests/integrations/loguru/test_loguru.py @@ -135,7 +135,7 @@ def test_levels( assert log.payload["attributes"]["sentry.origin"] == "auto.log.loguru" -def test_breadcrumb_format(sentry_init, capture_events, uninstall_integration, request): +def test_breadcrumb_format(sentry_init, uninstall_integration, request): uninstall_integration("loguru") request.addfinalizer(logger.remove) diff --git a/tests/integrations/openfeature/test_openfeature.py b/tests/integrations/openfeature/test_openfeature.py index fd5b2a8c85..4c222784bd 100644 --- a/tests/integrations/openfeature/test_openfeature.py +++ b/tests/integrations/openfeature/test_openfeature.py @@ -154,7 +154,6 @@ async def runner(): def test_openfeature_span_integration( sentry_init, - capture_events, capture_items, uninstall_integration, ): diff --git a/tests/integrations/pyramid/test_pyramid.py b/tests/integrations/pyramid/test_pyramid.py index 88dd704af7..77dcbedaf3 100644 --- a/tests/integrations/pyramid/test_pyramid.py +++ b/tests/integrations/pyramid/test_pyramid.py @@ -402,7 +402,7 @@ def error_handler(err, request): def test_error_in_authenticated_userid( - sentry_init, pyramid_config, capture_events, route, get_client + sentry_init, pyramid_config, capture_events, get_client ): from sentry_sdk.integrations.logging import LoggingIntegration diff --git a/tests/integrations/quart/test_quart.py b/tests/integrations/quart/test_quart.py index 347f3e0cd9..acd87b6909 100644 --- a/tests/integrations/quart/test_quart.py +++ b/tests/integrations/quart/test_quart.py @@ -228,7 +228,6 @@ async def test_quart_auth_configured( sentry_init, user_id, capture_events, - monkeypatch, integration_enabled_params, ): from quart_auth import AuthUser, login_user diff --git a/tests/integrations/redis/asyncio/test_redis_asyncio.py b/tests/integrations/redis/asyncio/test_redis_asyncio.py index f2a07bc0a4..05be4790a2 100644 --- a/tests/integrations/redis/asyncio/test_redis_asyncio.py +++ b/tests/integrations/redis/asyncio/test_redis_asyncio.py @@ -44,7 +44,6 @@ async def test_async_basic(sentry_init, capture_events): @pytest.mark.asyncio async def test_async_redis_pipeline( sentry_init, - capture_events, capture_items, is_transaction, send_default_pii, @@ -86,7 +85,7 @@ async def test_async_redis_pipeline( @pytest.mark.asyncio -async def test_async_span_origin(sentry_init, capture_events, capture_items): +async def test_async_span_origin(sentry_init, capture_items): sentry_init( integrations=[RedisIntegration()], traces_sample_rate=1.0, diff --git a/tests/integrations/redis/cluster/test_redis_cluster.py b/tests/integrations/redis/cluster/test_redis_cluster.py index 2f6072f844..70b347ef55 100644 --- a/tests/integrations/redis/cluster/test_redis_cluster.py +++ b/tests/integrations/redis/cluster/test_redis_cluster.py @@ -65,7 +65,6 @@ def test_rediscluster_breadcrumb(sentry_init, capture_events): ) def test_rediscluster_basic( sentry_init, - capture_events, capture_items, send_default_pii, description, @@ -114,7 +113,6 @@ def test_rediscluster_basic( ) def test_rediscluster_pipeline( sentry_init, - capture_events, capture_items, send_default_pii, expected_first_ten, @@ -157,7 +155,6 @@ def test_rediscluster_pipeline( def test_rediscluster_span_origin( sentry_init, - capture_events, capture_items, ): sentry_init( diff --git a/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py b/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py index adaf968272..b3b5f49e46 100644 --- a/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py +++ b/tests/integrations/redis/cluster_asyncio/test_redis_cluster_asyncio.py @@ -71,7 +71,6 @@ async def test_async_breadcrumb(sentry_init, capture_events): @pytest.mark.asyncio async def test_async_basic( sentry_init, - capture_events, capture_items, send_default_pii, description, diff --git a/tests/integrations/redis/test_redis.py b/tests/integrations/redis/test_redis.py index db0fa77410..68a3672c1c 100644 --- a/tests/integrations/redis/test_redis.py +++ b/tests/integrations/redis/test_redis.py @@ -57,7 +57,6 @@ def test_basic(sentry_init, capture_events): ) def test_redis_pipeline_data_collection( sentry_init, - capture_events, capture_items, data_collection, expected_first_ten, @@ -91,7 +90,6 @@ def test_redis_pipeline_data_collection( def test_pii_data_redacted( sentry_init, - capture_events, capture_items, ): sentry_init( @@ -139,7 +137,6 @@ def test_pii_data_redacted( ) def test_data_collection_database_query_data( sentry_init, - capture_events, capture_items, data_collection, expected_description, diff --git a/tests/integrations/redis/test_redis_cache_module.py b/tests/integrations/redis/test_redis_cache_module.py index 87984a2fc8..c81600e3d5 100644 --- a/tests/integrations/redis/test_redis_cache_module.py +++ b/tests/integrations/redis/test_redis_cache_module.py @@ -13,7 +13,7 @@ FAKEREDIS_VERSION = parse_version(fakeredis.__version__) -def test_no_cache_basic(sentry_init, capture_events, capture_items): +def test_no_cache_basic(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration(), @@ -36,7 +36,7 @@ def test_no_cache_basic(sentry_init, capture_events, capture_items): assert db_span["attributes"]["sentry.op"] == "db.redis" -def test_cache_basic(sentry_init, capture_events, capture_items): +def test_cache_basic(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( @@ -104,7 +104,7 @@ def test_cache_basic(sentry_init, capture_events, capture_items): assert payloads[9]["name"] == "custom parent" -def test_cache_keys(sentry_init, capture_events, capture_items): +def test_cache_keys(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( @@ -154,7 +154,7 @@ def test_cache_keys(sentry_init, capture_events, capture_items): assert payloads[6]["name"] == "custom parent" -def test_cache_data(sentry_init, capture_events, capture_items): +def test_cache_data(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( @@ -235,7 +235,7 @@ def test_cache_data(sentry_init, capture_events, capture_items): assert payloads[6]["name"] == "custom parent" -def test_cache_prefixes(sentry_init, capture_events, capture_items): +def test_cache_prefixes(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( diff --git a/tests/integrations/redis/test_redis_cache_module_async.py b/tests/integrations/redis/test_redis_cache_module_async.py index 669efbe0ee..467331eb1e 100644 --- a/tests/integrations/redis/test_redis_cache_module_async.py +++ b/tests/integrations/redis/test_redis_cache_module_async.py @@ -23,7 +23,7 @@ @pytest.mark.asyncio -async def test_no_cache_basic(sentry_init, capture_events, capture_items): +async def test_no_cache_basic(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration(), @@ -45,7 +45,7 @@ async def test_no_cache_basic(sentry_init, capture_events, capture_items): @pytest.mark.asyncio -async def test_cache_basic(sentry_init, capture_events, capture_items): +async def test_cache_basic(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( @@ -71,7 +71,7 @@ async def test_cache_basic(sentry_init, capture_events, capture_items): @pytest.mark.asyncio -async def test_cache_keys(sentry_init, capture_events, capture_items): +async def test_cache_keys(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( @@ -120,7 +120,7 @@ async def test_cache_keys(sentry_init, capture_events, capture_items): @pytest.mark.asyncio -async def test_cache_data(sentry_init, capture_events, capture_items): +async def test_cache_data(sentry_init, capture_items): sentry_init( integrations=[ RedisIntegration( diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index 4002fe94b6..417dd75781 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -1176,7 +1176,7 @@ def test_middleware_callback_spans(sentry_init, capture_items): assert span["attributes"]["middleware.name"] == exp["middleware_name"] -def test_middleware_receive_send(sentry_init, capture_events): +def test_middleware_receive_send(sentry_init): sentry_init( traces_sample_rate=1.0, integrations=[StarletteIntegration()], diff --git a/tests/integrations/starlite/test_starlite.py b/tests/integrations/starlite/test_starlite.py index d24bc465a9..de0e58ccc5 100644 --- a/tests/integrations/starlite/test_starlite.py +++ b/tests/integrations/starlite/test_starlite.py @@ -271,7 +271,7 @@ def is_matching_span(expected_span, actual_span): ) -def test_middleware_receive_send(sentry_init, capture_events): +def test_middleware_receive_send(sentry_init): class SampleReceiveSendMiddleware(AbstractMiddleware): async def __call__(self, scope, receive, send): message = await receive() diff --git a/tests/integrations/statsig/test_statsig.py b/tests/integrations/statsig/test_statsig.py index 7446f321b3..481ea60f8a 100644 --- a/tests/integrations/statsig/test_statsig.py +++ b/tests/integrations/statsig/test_statsig.py @@ -183,7 +183,6 @@ def test_wrapper_attributes(sentry_init, uninstall_integration): def test_statsig_span_integration( sentry_init, - capture_events, capture_items, uninstall_integration, ): diff --git a/tests/integrations/stdlib/test_httplib.py b/tests/integrations/stdlib/test_httplib.py index e7cf9e32b8..1fb344fb0c 100644 --- a/tests/integrations/stdlib/test_httplib.py +++ b/tests/integrations/stdlib/test_httplib.py @@ -817,7 +817,7 @@ def test_span_origin(sentry_init, capture_items): assert spans[0]["attributes"]["sentry.origin"] == "auto.http.stdlib.httplib" -def test_http_timeout(monkeypatch, sentry_init, capture_envelopes, capture_items): +def test_http_timeout(monkeypatch, sentry_init, capture_items): mock_readinto = mock.Mock(side_effect=TimeoutError) monkeypatch.setattr(SocketIO, "readinto", mock_readinto) diff --git a/tests/integrations/strawberry/test_strawberry.py b/tests/integrations/strawberry/test_strawberry.py index ccd7dfb0d7..d4ee58ec70 100644 --- a/tests/integrations/strawberry/test_strawberry.py +++ b/tests/integrations/strawberry/test_strawberry.py @@ -552,7 +552,6 @@ def test_breadcrumb_no_operation_name( def test_capture_segment_on_error( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -622,7 +621,6 @@ def test_capture_segment_on_error( def test_capture_segment_on_success( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -689,7 +687,6 @@ def test_capture_segment_on_success( def test_segment_no_operation_name( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -755,7 +752,6 @@ def test_segment_no_operation_name( def test_segment_mutation( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -847,7 +843,6 @@ def test_segment_mutation( def test_graphql_span_data_collection( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -952,7 +947,6 @@ def test_handle_none_query_gracefully_with_data_collection( def test_span_origin( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -1001,7 +995,6 @@ def test_span_origin( def test_span_origin2( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, @@ -1050,7 +1043,6 @@ def test_span_origin2( def test_span_origin3( request, sentry_init, - capture_events, capture_items, client_factory, async_execution, diff --git a/tests/integrations/threading/test_threading.py b/tests/integrations/threading/test_threading.py index 87c8569a99..1df593f3b5 100644 --- a/tests/integrations/threading/test_threading.py +++ b/tests/integrations/threading/test_threading.py @@ -127,9 +127,7 @@ def do_some_work(): (True, False), ids=["propagate_scope=True", "propagate_scope=False"], ) -def test_spans_from_multiple_threads( - sentry_init, capture_items, render_span_tree, propagate_scope -): +def test_spans_from_multiple_threads(sentry_init, capture_items, propagate_scope): sentry_init( traces_sample_rate=1.0, integrations=[ThreadingIntegration(propagate_scope=propagate_scope)], @@ -190,9 +188,7 @@ def do_some_work(number): (True, False), ids=["propagate_scope=True", "propagate_scope=False"], ) -def test_spans_from_threadpool( - sentry_init, capture_items, render_span_tree, propagate_scope -): +def test_spans_from_threadpool(sentry_init, capture_items, propagate_scope): sentry_init( traces_sample_rate=1.0, integrations=[ThreadingIntegration(propagate_scope=propagate_scope)], diff --git a/tests/integrations/tornado/test_tornado.py b/tests/integrations/tornado/test_tornado.py index ce4722cf98..288172971f 100644 --- a/tests/integrations/tornado/test_tornado.py +++ b/tests/integrations/tornado/test_tornado.py @@ -427,7 +427,6 @@ def test_request_body_data_collection_event_processor( def test_transactions( tornado_testcase, sentry_init, - capture_events, capture_items, handler, code, @@ -779,7 +778,6 @@ def test_error_has_existing_trace_context_performance_disabled( def test_span_origin( tornado_testcase, sentry_init, - capture_events, capture_items, ): sentry_init( diff --git a/tests/integrations/unleash/test_unleash.py b/tests/integrations/unleash/test_unleash.py index 9287fe51c4..0ebd278bcb 100644 --- a/tests/integrations/unleash/test_unleash.py +++ b/tests/integrations/unleash/test_unleash.py @@ -166,7 +166,6 @@ def test_wrapper_attributes(sentry_init, uninstall_integration): def test_unleash_span_integration( sentry_init, - capture_events, capture_items, uninstall_integration, ): diff --git a/tests/integrations/wsgi/test_wsgi.py b/tests/integrations/wsgi/test_wsgi.py index d0e08f2001..8c49472c92 100644 --- a/tests/integrations/wsgi/test_wsgi.py +++ b/tests/integrations/wsgi/test_wsgi.py @@ -83,9 +83,8 @@ def test_script_name_is_respected( assert event["request"]["url"] == "https://dogs.are.great/woof/woof/bark/" -@pytest.fixture(params=[0, None]) -def test_systemexit_zero_is_ignored(sentry_init, capture_events, request): - zero_code = request.param +@pytest.mark.parametrize("zero_code", [0, None]) +def test_systemexit_zero_is_ignored(sentry_init, capture_events, zero_code): sentry_init(data_collection={}) iterable = ExitingIterable(lambda: SystemExit(zero_code)) app = SentryWsgiMiddleware(IterableApp(iterable)) @@ -98,9 +97,8 @@ def test_systemexit_zero_is_ignored(sentry_init, capture_events, request): assert len(events) == 0 -@pytest.fixture(params=["", "foo", 1, 2]) -def test_systemexit_nonzero_is_captured(sentry_init, capture_events, request): - nonzero_code = request.param +@pytest.mark.parametrize("nonzero_code", ["", "foo", 1, 2]) +def test_systemexit_nonzero_is_captured(sentry_init, capture_events, nonzero_code): sentry_init(data_collection={}) iterable = ExitingIterable(lambda: SystemExit(nonzero_code)) app = SentryWsgiMiddleware(IterableApp(iterable)) @@ -115,7 +113,7 @@ def test_systemexit_nonzero_is_captured(sentry_init, capture_events, request): assert "exception" in event exc = event["exception"]["values"][-1] assert exc["type"] == "SystemExit" - assert exc["value"] == nonzero_code + assert exc["value"] == str(nonzero_code) assert event["level"] == "error" @@ -140,10 +138,7 @@ def test_keyboard_interrupt_is_captured(sentry_init, capture_events): def test_transaction_with_error( sentry_init, - crashing_app, - capture_events, capture_items, - DictionaryContaining, # noqa:N803 ): def dogpark(environ, start_response): raise ValueError("Fetch aborted. The ball was not returned.") @@ -196,9 +191,7 @@ def dogpark(environ, start_response): ) def test_transaction_no_error( sentry_init, - capture_events, capture_items, - DictionaryContaining, # noqa:N803 data_collection, expect_query, ): @@ -244,7 +237,6 @@ def dogpark(environ, start_response): def test_has_trace_if_performance_enabled( sentry_init, - capture_events, capture_items, ): def dogpark(environ, start_response): @@ -315,7 +307,6 @@ def dogpark(environ, start_response): def test_trace_from_headers_if_performance_enabled( sentry_init, - capture_events, capture_items, ): def dogpark(environ, start_response): @@ -513,7 +504,7 @@ def sample_app(environ, start_response): assert sum(agg.get("crashed", 0) for agg in session_aggregates) == 1 -def test_span_origin_manual(sentry_init, capture_events, capture_items): +def test_span_origin_manual(sentry_init, capture_items): def dogpark(environ, start_response): start_response("200 OK", []) return ["Go get the ball! Good dog!"] @@ -535,7 +526,7 @@ def dogpark(environ, start_response): assert items[0].payload["attributes"]["sentry.origin"] == "manual" -def test_span_origin_custom(sentry_init, capture_events, capture_items): +def test_span_origin_custom(sentry_init, capture_items): def dogpark(environ, start_response): start_response("200 OK", []) return ["Go get the ball! Good dog!"] diff --git a/tests/test_basics.py b/tests/test_basics.py index ce640b4c9e..1d3c20b1ae 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -240,7 +240,7 @@ def do_this(): assert event["breadcrumbs"]["values"] == [] -def test_breadcrumb_arguments(sentry_init, capture_events): +def test_breadcrumb_arguments(sentry_init): assert_hint = {"bar": 42} def before_breadcrumb(crumb, hint): diff --git a/tests/test_client.py b/tests/test_client.py index 11d0f409ce..9d0d1a2211 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -595,7 +595,7 @@ def test_capture_event_works(sentry_init): @pytest.mark.parametrize( "http2", [True, False] if sys.version_info >= (3, 8) else [False] ) -def test_atexit(tmpdir, monkeypatch, num_messages, http2): +def test_atexit(tmpdir, num_messages, http2): if http2: options = '_experiments={"transport_http2": True}' transport = "Http2Transport" diff --git a/tests/test_feature_flags.py b/tests/test_feature_flags.py index 4ba432b2d5..ac1c3235c2 100644 --- a/tests/test_feature_flags.py +++ b/tests/test_feature_flags.py @@ -8,7 +8,7 @@ from sentry_sdk.feature_flags import FlagBuffer, add_feature_flag -def test_featureflags_integration(sentry_init, capture_events, uninstall_integration): +def test_featureflags_integration(sentry_init, capture_events): sentry_init() add_feature_flag("hello", False) @@ -85,9 +85,7 @@ def test_featureflags_integration_spans_sync(sentry_init, capture_events): assert found, "No event with exception found" -def test_featureflags_integration_threaded( - sentry_init, capture_events, uninstall_integration -): +def test_featureflags_integration_threaded(sentry_init, capture_events): sentry_init() events = capture_events() @@ -133,9 +131,7 @@ def task(flag_key): } -def test_featureflags_integration_asyncio( - sentry_init, capture_events, uninstall_integration -): +def test_featureflags_integration_asyncio(sentry_init, capture_events): asyncio = pytest.importorskip("asyncio") sentry_init() diff --git a/tests/test_gevent.py b/tests/test_gevent.py index 233d629f99..fc42860925 100644 --- a/tests/test_gevent.py +++ b/tests/test_gevent.py @@ -10,19 +10,6 @@ pytest.importorskip("gevent") -@pytest.fixture(scope="module") -def monkeypatched_gevent(): - try: - import gevent - - gevent.monkey.patch_all() - except Exception as e: - if "_RLock__owner" in str(e): - pytest.skip("https://github.com/gevent/gevent/issues/1380") - else: - raise - - @pytest.fixture def capturing_server(request, wsgi_capturing_server): wsgi_capturing_server.start() diff --git a/tests/test_logs.py b/tests/test_logs.py index 7a9c90a566..c3d92fc601 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -736,7 +736,7 @@ class Cat: assert isinstance(log["attributes"]["inhomogeneous_tuple"], str) -def test_array_attributes_deep_copied_in_before_send(sentry_init, capture_envelopes): +def test_array_attributes_deep_copied_in_before_send(sentry_init): """We don't surface user-held references to objects in attributes.""" strings = ["value1", "value2"] diff --git a/tests/test_metrics.py b/tests/test_metrics.py index dab4b60706..8a4cfacfe5 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -466,7 +466,7 @@ class Cat: assert isinstance(metric["attributes"]["dictionary"], str) -def test_array_attributes_deep_copied_in_before_send(sentry_init, capture_envelopes): +def test_array_attributes_deep_copied_in_before_send(sentry_init): """We don't surface user-held references to objects in attributes.""" strings = ["value1", "value2"] diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 2696dd5c94..f7c0b32337 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -58,9 +58,7 @@ def test_monitor_unhealthy(sentry_init): assert monitor.downsample_factor == (i + 1 if i < 10 else 10) -def test_segment_uses_downsampled_rate( - sentry_init, capture_record_lost_event_calls, monkeypatch -): +def test_segment_uses_downsampled_rate(sentry_init, capture_record_lost_event_calls): sentry_init( traces_sample_rate=1.0, transport=UnhealthyTestTransport(), diff --git a/tests/test_transport.py b/tests/test_transport.py index 2ae25458ce..02f0c8389b 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -383,7 +383,7 @@ def test_socket_options_override_defaults(make_client): assert options["socket_options"] == [] -def test_transport_infinite_loop(capturing_server, request, make_client): +def test_transport_infinite_loop(capturing_server, make_client): client = make_client( debug=True, # Make sure we cannot create events from our own logging diff --git a/tests/tracing/test_integration_tests.py b/tests/tracing/test_integration_tests.py index 555ce40c29..5be25a4344 100644 --- a/tests/tracing/test_integration_tests.py +++ b/tests/tracing/test_integration_tests.py @@ -188,7 +188,7 @@ def test_continue_trace(sentry_init, capture_items, parent_sampled, sample_rate) @pytest.mark.parametrize("sample_rate", [0.5, 1.0]) def test_dynamic_sampling_head_sdk_creates_dsc( - sentry_init, capture_envelopes, sample_rate, monkeypatch + sentry_init, capture_envelopes, sample_rate ): sentry_init( traces_sample_rate=sample_rate, @@ -252,7 +252,7 @@ def test_dynamic_sampling_head_sdk_creates_dsc( "args", [{"traces_sample_rate": 1.0}, {"traces_sample_rate": 0.0}], ) -def test_memory_usage(sentry_init, capture_events, args): +def test_memory_usage(sentry_init, args): sentry_init(**args) references = weakref.WeakSet() diff --git a/tests/tracing/test_sampling.py b/tests/tracing/test_sampling.py index 06a18c59bc..2f474a0213 100644 --- a/tests/tracing/test_sampling.py +++ b/tests/tracing/test_sampling.py @@ -9,7 +9,7 @@ from sentry_sdk.utils import logger -def test_sampling_decided_only_for_segments(sentry_init, capture_events): +def test_sampling_decided_only_for_segments(sentry_init): sentry_init( traces_sample_rate=0.5, ) diff --git a/tests/tracing/test_span_batcher.py b/tests/tracing/test_span_batcher.py index 8bd56a08e2..6fb8c18d11 100644 --- a/tests/tracing/test_span_batcher.py +++ b/tests/tracing/test_span_batcher.py @@ -9,7 +9,7 @@ from sentry_sdk._span_batcher import SpanBatcher -def test_envelope_by_trace_id(sentry_init, capture_envelopes, monkeypatch): +def test_envelope_by_trace_id(sentry_init, capture_envelopes): """Envelopes only contain spans of one trace ID.""" sentry_init( traces_sample_rate=1.0,