Skip regex tests on older MongoDB versions

This commit is contained in:
A. Jesse Jiryu Davis 2013-10-20 21:28:45 -04:00
parent bdc0398ee6
commit 25343af3b4
2 changed files with 12 additions and 6 deletions

View File

@ -1269,8 +1269,11 @@ class TestCollection(unittest.TestCase):
self.assertEqual(expected, db.test.aggregate((pipeline,)))
def test_aggregate_with_compile_re(self):
if not version.at_least(self.db.connection, (2, 1, 0)):
raise SkipTest("The aggregate command requires MongoDB >= 2.1.0")
# See SERVER-6470.
if not version.at_least(self.db.connection, (2, 3, 2)):
raise SkipTest(
"Retrieving a regex with aggregation requires "
"MongoDB >= 2.3.2")
db = self.client.pymongo_test
db.test.drop()

View File

@ -306,10 +306,13 @@ class TestDatabase(unittest.TestCase):
db.command('eval', 'sleep(100)', network_timeout=0.001)
def test_command_with_compile_re(self):
# Using 'aggregate' as our example command, since it's an easy way to
# retrieve a BSON regex from a collection using a command.
if not version.at_least(self.client, (2, 1, 0)):
raise SkipTest('Need aggregation to test compile_re')
# We use 'aggregate' as our example command, since it's an easy way to
# retrieve a BSON regex from a collection using a command. But until
# MongoDB 2.3.2, aggregation turned regexes into strings: SERVER-6470.
if not version.at_least(self.client, (2, 3, 2)):
raise SkipTest(
"Retrieving a regex with aggregation requires "
"MongoDB >= 2.3.2")
db = self.client.pymongo_test
db.test.drop()