summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/image/v2/test_image.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-07-21 00:10:54 +0000
committerGerrit Code Review <review@openstack.org>2017-07-21 00:10:54 +0000
commitd04a7cf92af4548bb259e3f3c871b06aca392b7a (patch)
tree9d8d8c265c64b6520488b4bbb5d93bcbc8090106 /openstackclient/tests/functional/image/v2/test_image.py
parent57e7d9fdb33c17a96460655e46ff93bc9d19f807 (diff)
parentf1d32dbe9b6f5f2e47853b9969483fa841e451f4 (diff)
downloadpython-openstackclient-d04a7cf92af4548bb259e3f3c871b06aca392b7a.tar.gz
Merge "Clean up the changes of os.environ in functional tests"
Diffstat (limited to 'openstackclient/tests/functional/image/v2/test_image.py')
-rw-r--r--openstackclient/tests/functional/image/v2/test_image.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/openstackclient/tests/functional/image/v2/test_image.py b/openstackclient/tests/functional/image/v2/test_image.py
index a93fa8cb..278ba5b9 100644
--- a/openstackclient/tests/functional/image/v2/test_image.py
+++ b/openstackclient/tests/functional/image/v2/test_image.py
@@ -11,9 +11,9 @@
# under the License.
import json
-import os
import uuid
+import fixtures
# from glanceclient import exc as image_exceptions
from openstackclient.tests.functional import base
@@ -27,8 +27,9 @@ class ImageTests(base.TestCase):
@classmethod
def setUpClass(cls):
- os.environ['OS_IMAGE_API_VERSION'] = '2'
+ super(ImageTests, cls).setUpClass()
json_output = json.loads(cls.openstack(
+ '--os-image-api-version 2 '
'image create -f json ' +
cls.NAME
))
@@ -37,10 +38,21 @@ class ImageTests(base.TestCase):
@classmethod
def tearDownClass(cls):
- cls.openstack(
- 'image delete ' +
- cls.image_id
+ try:
+ cls.openstack(
+ '--os-image-api-version 2 '
+ 'image delete ' +
+ cls.image_id
+ )
+ finally:
+ super(ImageTests, cls).tearDownClass()
+
+ def setUp(self):
+ super(ImageTests, self).setUp()
+ ver_fixture = fixtures.EnvironmentVariable(
+ 'OS_IMAGE_API_VERSION', '2'
)
+ self.useFixture(ver_fixture)
def test_image_list(self):
json_output = json.loads(self.openstack(