Skip to content

Commit

Permalink
MOTOR-1182 Attach an error code to workaround PYTHON-4038 (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneHarvey committed Nov 10, 2023
1 parent cb050ef commit 5e6453a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/tornado_tests/test_motor_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,19 @@ async def _test_exhaust_query_server_error(self, rs):
client = motor.MotorClient(server.uri, maxPoolSize=1)
await client.admin.command("ismaster")
pool = get_primary_pool(client)
conns = pool.conns
conn = one(conns)
conn = one(pool.conns)
cursor = client.db.collection.find(cursor_type=CursorType.EXHAUST)

# With Tornado, simply accessing fetch_next starts the fetch.
fetch_next = cursor.fetch_next
request = await self.run_thread(server.receives, OpQuery)
request.fail()
request.fail(code=1)

with self.assertRaises(pymongo.errors.OperationFailure):
await fetch_next

self.assertFalse(conn.closed)
conns = pool.conns
self.assertEqual(conn, one(conns))
self.assertEqual(conn, one(pool.conns))

@gen_test
async def test_exhaust_query_server_error_standalone(self):
Expand Down

0 comments on commit 5e6453a

Please sign in to comment.