@gen_test
    def test_del_on_main_greenlet(self):
        if tornado_version < (4, 0, 0, 0):
            raise SkipTest("Tornado 3")

        # Since __del__ can happen on any greenlet, cursor must be
        # prepared to close itself correctly on main or a child.
        client, server = self.client_server(auto_ismaster=True)
        cursor = client.test.collection.find()

        future = cursor.fetch_next
        request = yield self.run_thread(server.receives, OpQuery)
        request.replies({'_id': 1}, cursor_id=123)
        yield future  # Complete the first fetch.

        # Dereference the cursor.
        del cursor

        # Let the event loop iterate once more to clear its references to
        # callbacks, allowing the cursor to be freed.
        yield self.pause(0)
        if 'PyPy' in sys.version:
            gc.collect()

        yield self.run_thread(server.receives, OpKillCursors)
dataset/ETHPy150Open mongodb/motor/test/tornado_tests/test_motor_cursor.py/MotorCursorTest.test_del_on_main_greenlet/original