From 39c41b277ec5534f1cd92cd933e31b15aee3c7a6 Mon Sep 17 00:00:00 2001 From: Bernie Hackett Date: Mon, 13 Jul 2015 17:18:49 -0700 Subject: [PATCH] Fix $comment tests for MongoDB 3.1.x. --- test/test_cursor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_cursor.py b/test/test_cursor.py index 427b4228e..4595ccc40 100644 --- a/test/test_cursor.py +++ b/test/test_cursor.py @@ -1052,9 +1052,12 @@ class TestCursor(IntegrationTest): run_with_profiling(find) + # MongoDB 3.1.5 changed the ns for commands. + regex = {'$regex': 'pymongo_test.(\$cmd|test)'} + def count(): self.db.test.find().comment('foo').count() - op = self.db.system.profile.find({'ns': 'pymongo_test.$cmd', + op = self.db.system.profile.find({'ns': regex, 'op': 'command', 'command.count': 'test', 'command.$comment': 'foo'}) @@ -1064,7 +1067,7 @@ class TestCursor(IntegrationTest): def distinct(): self.db.test.find().comment('foo').distinct('type') - op = self.db.system.profile.find({'ns': 'pymongo_test.$cmd', + op = self.db.system.profile.find({'ns': regex, 'op': 'command', 'command.distinct': 'test', 'command.$comment': 'foo'})