Fixed ValueError caused by mongodb rc version: invalid literal for in… (#816)

* Fixed ValueError caused by mongodb rc version: invalid literal for int () with base 10

* add test fix ValueError caused by mongodb rc version
This commit is contained in:
dust8 2018-01-13 22:52:52 +08:00 committed by Asif Saifuddin Auvi
parent 9883a300f6
commit e209fa6f84
2 changed files with 10 additions and 0 deletions

View File

@ -303,6 +303,7 @@ class Channel(virtual.Channel):
database = mongoconn[dbname]
version_str = mongoconn.server_info()['version']
version_str = version_str.split('-')[0]
version = tuple(map(int, version_str.split('.')))
if version < (1, 3):

View File

@ -359,6 +359,15 @@ class test_mongodb_channel(BaseMongoDBChannelCase):
filter={'queue': 'fanout_exchange1'},
)
def test_open_rc_version(self):
import pymongo
def server_info(self):
return {'version': '3.6.0-rc'}
with patch.object(pymongo.MongoClient, 'server_info', server_info):
self.channel._open()
@skip.unless_module('pymongo')
class test_mongodb_channel_ttl(BaseMongoDBChannelCase):