PYTHON-1739 Skip failing change stream test on sharded clusters (#397)

This commit is contained in:
Shane Harvey 2019-02-07 16:01:32 -08:00 committed by GitHub
parent 19827c41ec
commit 9dcd828a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -296,13 +296,16 @@ class TestCollectionChangeStream(IntegrationTest):
change = next(change_stream)
self.assertEqual(change['_id'], change_stream._resume_token)
@client_context.require_no_mongos # PYTHON-1739
def test_raises_error_on_missing_id(self):
"""ChangeStream will raise an exception if the server response is
missing the resume token.
"""
with self.coll.watch([{'$project': {'_id': 0}}]) as change_stream:
self.coll.insert_one({})
with self.assertRaises(InvalidOperation):
# Server returns an error after SERVER-37786, otherwise pymongo
# raises an error.
with self.assertRaises((InvalidOperation, OperationFailure)):
next(change_stream)
# The cursor should now be closed.
with self.assertRaises(StopIteration):