Fix a few tests with really old mongos versions.
This commit is contained in:
parent
2cc560c671
commit
13cd9bee6f
@ -893,10 +893,13 @@ class TestBulkWriteConcern(BulkTestBase):
|
||||
ismaster = client.test.command('ismaster')
|
||||
self.is_repl = bool(ismaster.get('setName'))
|
||||
self.w = len(ismaster.get("hosts", []))
|
||||
self.client = client
|
||||
self.coll = client.pymongo_test.test
|
||||
self.coll.remove()
|
||||
|
||||
def test_fsync_and_j(self):
|
||||
if not version.at_least(self.client, (1, 8, 2)):
|
||||
raise SkipTest("Need at least MongoDB 1.8.2")
|
||||
batch = self.coll.initialize_ordered_bulk_op()
|
||||
batch.insert({'a': 1})
|
||||
self.assertRaises(
|
||||
|
||||
@ -1343,8 +1343,9 @@ class TestCollection(unittest.TestCase):
|
||||
self.fail("WTimeoutError was not raised")
|
||||
|
||||
# can't use fsync and j options together
|
||||
self.assertRaises(OperationFailure, self.db.test.insert,
|
||||
{"_id": 1}, j=True, fsync=True)
|
||||
if version.at_least(self.client, (1, 8, 2)):
|
||||
self.assertRaises(OperationFailure, self.db.test.insert,
|
||||
{"_id": 1}, j=True, fsync=True)
|
||||
|
||||
def test_manual_last_error(self):
|
||||
self.db.test.save({"x": 1}, w=0)
|
||||
|
||||
@ -953,8 +953,8 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertRaises(UserWarning, self.client.pymongo_test.command,
|
||||
'ping', read_preference=ReadPreference.SECONDARY)
|
||||
try:
|
||||
self.client.pymongo_test.command(
|
||||
'dbStats', read_preference=ReadPreference.SECONDARY)
|
||||
self.client.pymongo_test.command('dbStats',
|
||||
read_preference=ReadPreference.SECONDARY_PREFERRED)
|
||||
except UserWarning:
|
||||
self.fail("Shouldn't have raised UserWarning.")
|
||||
finally:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user