Further harden boto version checking in EC2 tests
Use pkg_resources to determine correct boto interface to use in API tests. stable/grizzly version. Fixes Bug #1239220 Change-Id: I455ce5f2aabfad7178be361844c6b9b7b0d9c946
This commit is contained in:
parent
7b2b6738c6
commit
0409a098de
|
@ -18,6 +18,7 @@
|
|||
|
||||
"""Unit tests for the API endpoint."""
|
||||
|
||||
import pkg_resources
|
||||
import random
|
||||
import StringIO
|
||||
|
||||
|
@ -241,10 +242,11 @@ class ApiEc2TestCase(test.TestCase):
|
|||
self.http = FakeHttplibConnection(
|
||||
self.app, '%s:8773' % (self.host), False)
|
||||
# pylint: disable=E1103
|
||||
if boto.Version >= '2.13':
|
||||
boto_version = pkg_resources.parse_version(boto.Version)
|
||||
if boto_version >= pkg_resources.parse_version('2.13'):
|
||||
self.ec2.new_http_connection(host or self.host, 8773,
|
||||
is_secure).AndReturn(self.http)
|
||||
elif boto.Version >= '2':
|
||||
elif boto_version >= pkg_resources.parse_version('2'):
|
||||
self.ec2.new_http_connection(host or '%s:8773' % (self.host),
|
||||
is_secure).AndReturn(self.http)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue