Skip to content

Commit b93c105

Browse files
committed
PYTHON-985 - Fix cursor test for is_mongos changes
1 parent 596f80f commit b93c105

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/test_cursor.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,6 @@ def test_add_remove_option(self):
122122
cursor.remove_option(32)
123123
self.assertEqual(2, cursor._Cursor__query_flags)
124124

125-
# Exhaust - which mongos doesn't support
126-
cursor = self.db.test.find(cursor_type=CursorType.EXHAUST)
127-
self.assertEqual(64, cursor._Cursor__query_flags)
128-
cursor2 = self.db.test.find().add_option(64)
129-
self.assertEqual(cursor._Cursor__query_flags,
130-
cursor2._Cursor__query_flags)
131-
self.assertTrue(cursor._Cursor__exhaust)
132-
cursor.remove_option(64)
133-
self.assertEqual(0, cursor._Cursor__query_flags)
134-
self.assertFalse(cursor._Cursor__exhaust)
135-
136125
# Partial
137126
cursor = self.db.test.find(allow_partial_results=True)
138127
self.assertEqual(128, cursor._Cursor__query_flags)
@@ -142,6 +131,18 @@ def test_add_remove_option(self):
142131
cursor.remove_option(128)
143132
self.assertEqual(0, cursor._Cursor__query_flags)
144133

134+
# Exhaust - which mongos doesn't support
135+
if not self.db.client.is_mongos:
136+
cursor = self.db.test.find(cursor_type=CursorType.EXHAUST)
137+
self.assertEqual(64, cursor._Cursor__query_flags)
138+
cursor2 = self.db.test.find().add_option(64)
139+
self.assertEqual(cursor._Cursor__query_flags,
140+
cursor2._Cursor__query_flags)
141+
self.assertTrue(cursor._Cursor__exhaust)
142+
cursor.remove_option(64)
143+
self.assertEqual(0, cursor._Cursor__query_flags)
144+
self.assertFalse(cursor._Cursor__exhaust)
145+
145146

146147
class TestCursor(IntegrationTest):
147148

0 commit comments

Comments
 (0)