Skip to content

Commit 25343af

Browse files
committed
Skip regex tests on older MongoDB versions
1 parent bdc0398 commit 25343af

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

test/test_collection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,11 @@ def test_aggregate(self):
12691269
self.assertEqual(expected, db.test.aggregate((pipeline,)))
12701270

12711271
def test_aggregate_with_compile_re(self):
1272-
if not version.at_least(self.db.connection, (2, 1, 0)):
1273-
raise SkipTest("The aggregate command requires MongoDB >= 2.1.0")
1272+
# See SERVER-6470.
1273+
if not version.at_least(self.db.connection, (2, 3, 2)):
1274+
raise SkipTest(
1275+
"Retrieving a regex with aggregation requires "
1276+
"MongoDB >= 2.3.2")
12741277

12751278
db = self.client.pymongo_test
12761279
db.test.drop()

test/test_database.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,13 @@ def test_command_ignores_network_timeout(self):
306306
db.command('eval', 'sleep(100)', network_timeout=0.001)
307307

308308
def test_command_with_compile_re(self):
309-
# Using 'aggregate' as our example command, since it's an easy way to
310-
# retrieve a BSON regex from a collection using a command.
311-
if not version.at_least(self.client, (2, 1, 0)):
312-
raise SkipTest('Need aggregation to test compile_re')
309+
# We use 'aggregate' as our example command, since it's an easy way to
310+
# retrieve a BSON regex from a collection using a command. But until
311+
# MongoDB 2.3.2, aggregation turned regexes into strings: SERVER-6470.
312+
if not version.at_least(self.client, (2, 3, 2)):
313+
raise SkipTest(
314+
"Retrieving a regex with aggregation requires "
315+
"MongoDB >= 2.3.2")
313316

314317
db = self.client.pymongo_test
315318
db.test.drop()

0 commit comments

Comments
 (0)