From 0409a098de02407e8229183ee55f11252c0a3cf4 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Mon, 14 Oct 2013 18:01:15 -0700 Subject: [PATCH] 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 --- nova/tests/test_api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index 0e733d15f218..74e3e8226739 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -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: