diff --git a/functional/tests/identity/v3/test_identity.py b/functional/tests/identity/v3/test_identity.py index 3f98874..9281f9a 100644 --- a/functional/tests/identity/v3/test_identity.py +++ b/functional/tests/identity/v3/test_identity.py @@ -54,6 +54,9 @@ class IdentityTests(test.TestCase): if hasattr(super(IdentityTests, cls), 'setUpClass'): super(IdentityTests, cls).setUpClass() + # Backup old environment variables + cls._old_env = os.environ + # prepare v3 env auth_url = os.environ.get('OS_AUTH_URL') auth_url = auth_url.replace('v2.0', 'v3') @@ -91,6 +94,9 @@ class IdentityTests(test.TestCase): cls.openstack('domain set --disable %s' % cls.domain_name) cls.openstack('domain delete %s' % cls.domain_name) + # Restore environment variables + os.environ = cls._old_env + if hasattr(super(IdentityTests, cls), 'tearDownClass'): super(IdentityTests, cls).tearDownClass() diff --git a/functional/tests/volume/v1/common.py b/functional/tests/volume/v1/common.py index 7d35ed5..8a4412f 100644 --- a/functional/tests/volume/v1/common.py +++ b/functional/tests/volume/v1/common.py @@ -20,4 +20,9 @@ class BaseVolumeTests(test.TestCase): @classmethod def setUpClass(cls): + cls._old_env = os.environ os.environ['OS_VOLUME_API_VERSION'] = '1' + + @classmethod + def tearDownClass(cls): + os.environ = cls._old_env diff --git a/functional/tests/volume/v2/common.py b/functional/tests/volume/v2/common.py index 8652c2d..a881865 100644 --- a/functional/tests/volume/v2/common.py +++ b/functional/tests/volume/v2/common.py @@ -20,4 +20,9 @@ class BaseVolumeTests(test.TestCase): @classmethod def setUpClass(cls): + cls._old_env = os.environ os.environ['OS_VOLUME_API_VERSION'] = '2' + + @classmethod + def tearDownClass(cls): + os.environ = cls._old_env