File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2121
2222sys .path [0 :0 ] = ["" ]
2323
24+ from nose .plugins .skip import SkipTest
25+
2426from bson .objectid import ObjectId
2527from bson .son import SON
2628from pymongo .connection import Connection
@@ -305,8 +307,9 @@ def test_mongo_client(self):
305307 def test_replica_set_connection (self ):
306308 c = Connection (pair )
307309 ismaster = c .admin .command ('ismaster' )
308- setname = str (ismaster .get ('setName' ))
309- if not setname :
310+ if 'setName' in ismaster :
311+ setname = str (ismaster .get ('setName' ))
312+ else :
310313 raise SkipTest ("Not connected to a replica set." )
311314 c = ReplicaSetConnection (pair , replicaSet = setname )
312315 coll = c .pymongo_test .write_concern_test
@@ -339,8 +342,9 @@ def test_replica_set_connection(self):
339342 def test_mongo_replica_set_client (self ):
340343 c = Connection (pair )
341344 ismaster = c .admin .command ('ismaster' )
342- setname = str (ismaster .get ('setName' ))
343- if not setname :
345+ if 'setName' in ismaster :
346+ setname = str (ismaster .get ('setName' ))
347+ else :
344348 raise SkipTest ("Not connected to a replica set." )
345349 m = MongoReplicaSetClient (pair , replicaSet = setname , w = 0 )
346350 coll = m .pymongo_test .write_concern_test
You can’t perform that action at this time.
0 commit comments