From bbc7605f22fe8b7f7d6a09d808431bd040e6d825 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Fri, 6 Jun 2025 14:00:10 +0200 Subject: [PATCH] test: Assert `traces_sampler` called once Currently, this test only asserts that the `traces_sampler` is called at least once with the given arguments. However, we would expect it to be called exactly once. This PR changes the assertion to assert that the `traces_sampler` was called exactly one time, and that that call included the given arguments. --- tests/tracing/test_sampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tracing/test_sampling.py b/tests/tracing/test_sampling.py index bfd845d26d..3621aad6c7 100644 --- a/tests/tracing/test_sampling.py +++ b/tests/tracing/test_sampling.py @@ -218,7 +218,7 @@ def test_passes_attributes_from_start_span_to_traces_sampler( sentry_init(traces_sampler=traces_sampler) with start_span(attributes={"dogs": "yes", "cats": "maybe"}): - traces_sampler.assert_any_call( + traces_sampler.assert_called_once_with( DictionaryContaining({"dogs": "yes", "cats": "maybe"}) )