@@ -204,10 +204,15 @@ def test_capture_statement_getmore(self):
204204 )
205205 mock_event = MockEvent (command_attrs )
206206 command_tracer .started (event = mock_event )
207- # pylint: disable=protected-access
208- span = command_tracer ._pop_span (mock_event )
207+ command_tracer .succeeded (event = mock_event )
208+
209+ spans_list = self .memory_exporter .get_finished_spans ()
210+
211+ self .assertEqual (len (spans_list ), 1 )
212+ span = spans_list [0 ]
213+
209214 self .assertEqual (
210- span .attributes [SpanAttributes .DB_STATEMENT ],
215+ span .attributes [SpanAttributes .DB_STATEMENT ],
211216 "getMore test_collection"
212217 )
213218
@@ -222,11 +227,16 @@ def test_capture_statement_aggregate(self):
222227 )
223228 mock_event = MockEvent (command_attrs )
224229 command_tracer .started (event = mock_event )
225- # pylint: disable=protected-access
226- span = command_tracer ._pop_span (mock_event )
230+ command_tracer .succeeded (event = mock_event )
231+
232+ spans_list = self .memory_exporter .get_finished_spans ()
233+
234+ self .assertEqual (len (spans_list ), 1 )
235+ span = spans_list [0 ]
236+
227237 expected_statement = f"aggregate { pipeline } "
228238 self .assertEqual (
229- span .attributes [SpanAttributes .DB_STATEMENT ],
239+ span .attributes [SpanAttributes .DB_STATEMENT ],
230240 expected_statement
231241 )
232242
@@ -240,10 +250,15 @@ def test_capture_statement_disabled_getmore(self):
240250 )
241251 mock_event = MockEvent (command_attrs )
242252 command_tracer .started (event = mock_event )
243- # pylint: disable=protected-access
244- span = command_tracer ._pop_span (mock_event )
253+ command_tracer .succeeded (event = mock_event )
254+
255+ spans_list = self .memory_exporter .get_finished_spans ()
256+
257+ self .assertEqual (len (spans_list ), 1 )
258+ span = spans_list [0 ]
259+
245260 self .assertEqual (
246- span .attributes [SpanAttributes .DB_STATEMENT ],
261+ span .attributes [SpanAttributes .DB_STATEMENT ],
247262 "getMore"
248263 )
249264
@@ -258,10 +273,15 @@ def test_capture_statement_disabled_aggregate(self):
258273 )
259274 mock_event = MockEvent (command_attrs )
260275 command_tracer .started (event = mock_event )
261- # pylint: disable=protected-access
262- span = command_tracer ._pop_span (mock_event )
276+ command_tracer .succeeded (event = mock_event )
277+
278+ spans_list = self .memory_exporter .get_finished_spans ()
279+
280+ self .assertEqual (len (spans_list ), 1 )
281+ span = spans_list [0 ]
282+
263283 self .assertEqual (
264- span .attributes [SpanAttributes .DB_STATEMENT ],
284+ span .attributes [SpanAttributes .DB_STATEMENT ],
265285 "aggregate"
266286 )
267287
0 commit comments