using ConfigParser.read_file for PY3

This commit is contained in:
Yu Ming Zhu 2018-11-06 00:15:03 +00:00 committed by Mike McLean
parent 8cc1c93dc2
commit 9ddae41877
6 changed files with 76 additions and 23 deletions

View file

@ -270,7 +270,10 @@ connect_timeout = 10
send_timeout = 60
""")
conf = SafeConfigParser()
conf.readfp(confdata)
if six.PY2:
conf.readfp(confdata)
else:
conf.read_file(confdata)
self.handler = protonmsg.TimeoutHandler('amqps://broker1.example.com:5671', [], conf)
@patch('protonmsg.SSLDomain')
@ -291,7 +294,10 @@ connect_timeout = 10
send_timeout = 60
""")
conf = SafeConfigParser()
conf.readfp(confdata)
if six.PY2:
conf.readfp(confdata)
else:
conf.read_file(confdata)
handler = protonmsg.TimeoutHandler('amqp://broker1.example.com:5672', [], conf)
event = MagicMock()
handler.on_start(event)