@@ -282,48 +282,47 @@ def test_where(self):
282282 def test_kill_cursors (self ):
283283 db = self .db
284284 db .drop_collection ("test" )
285- intr = self .db .connection ().intr
286285
287- client_cursors = intr . cursors . find_one ( )["clientCursors_size" ]
288- by_location = intr . cursors . find_one ( )["byLocation_size" ]
286+ client_cursors = db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ]
287+ by_location = db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ]
289288
290289 for i in range (10000 ):
291290 db .test .insert ({"i" : i })
292291
293- self .assertEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
294- self .assertEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
292+ self .assertEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
293+ self .assertEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
295294
296295 for _ in range (10 ):
297296 db .test .find_one ()
298297
299- self .assertEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
300- self .assertEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
298+ self .assertEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
299+ self .assertEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
301300
302301 for _ in range (10 ):
303302 for x in db .test .find ():
304303 break
305304
306- self .assertEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
307- self .assertEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
305+ self .assertEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
306+ self .assertEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
308307
309308 a = db .test .find ()
310309 for x in a :
311310 break
312311
313- self .assertNotEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
314- self .assertNotEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
312+ self .assertNotEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
313+ self .assertNotEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
315314
316315 del a
317316
318- self .assertEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
319- self .assertEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
317+ self .assertEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
318+ self .assertEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
320319
321320 a = db .test .find ().limit (10 )
322321 for x in a :
323322 break
324323
325- self .assertEqual (client_cursors , intr . cursors . find_one ( )["clientCursors_size" ])
326- self .assertEqual (by_location , intr . cursors . find_one ( )["byLocation_size" ])
324+ self .assertEqual (client_cursors , db . _command ({ "cursorInfo" : 1 } )["clientCursors_size" ])
325+ self .assertEqual (by_location , db . _command ({ "cursorInfo" : 1 } )["byLocation_size" ])
327326
328327if __name__ == "__main__" :
329328 unittest .main ()
0 commit comments