diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-07-21 00:10:54 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-07-21 00:10:54 +0000 |
| commit | d04a7cf92af4548bb259e3f3c871b06aca392b7a (patch) | |
| tree | 9d8d8c265c64b6520488b4bbb5d93bcbc8090106 /openstackclient/tests/functional/common | |
| parent | 57e7d9fdb33c17a96460655e46ff93bc9d19f807 (diff) | |
| parent | f1d32dbe9b6f5f2e47853b9969483fa841e451f4 (diff) | |
| download | python-openstackclient-d04a7cf92af4548bb259e3f3c871b06aca392b7a.tar.gz | |
Merge "Clean up the changes of os.environ in functional tests"
Diffstat (limited to 'openstackclient/tests/functional/common')
| -rw-r--r-- | openstackclient/tests/functional/common/test_extension.py | 1 | ||||
| -rw-r--r-- | openstackclient/tests/functional/common/test_help.py | 14 | ||||
| -rw-r--r-- | openstackclient/tests/functional/common/test_quota.py | 1 |
3 files changed, 9 insertions, 7 deletions
diff --git a/openstackclient/tests/functional/common/test_extension.py b/openstackclient/tests/functional/common/test_extension.py index d7dc398b..e3a91fe6 100644 --- a/openstackclient/tests/functional/common/test_extension.py +++ b/openstackclient/tests/functional/common/test_extension.py @@ -25,6 +25,7 @@ class ExtensionTests(base.TestCase): @classmethod def setUpClass(cls): + super(ExtensionTests, cls).setUpClass() cls.haz_network = base.is_service_enabled('network') def test_extension_list_compute(self): diff --git a/openstackclient/tests/functional/common/test_help.py b/openstackclient/tests/functional/common/test_help.py index e31d3b86..7f274099 100644 --- a/openstackclient/tests/functional/common/test_help.py +++ b/openstackclient/tests/functional/common/test_help.py @@ -12,6 +12,8 @@ import os +import fixtures + from openstackclient.tests.functional import base @@ -76,10 +78,11 @@ class HelpTests(base.TestCase): def test_commands_help_no_auth(self): """Check help commands without auth info.""" - # Pop all auth info - auth_info = {key: os.environ.pop(key) - for key in os.environ.keys() - if key.startswith('OS_')} + # Pop all auth info. os.environ will be changed in loop, so do not + # replace os.environ.keys() to os.environ + for key in os.environ.keys(): + if key.startswith('OS_'): + self.useFixture(fixtures.EnvironmentVariable(key, None)) raw_output = self.openstack('help') self.assertIn('usage: openstack', raw_output) @@ -115,6 +118,3 @@ class HelpTests(base.TestCase): self.assertIn('List containers', raw_output) raw_output = self.openstack('container list --help') self.assertIn('List containers', raw_output) - - # Restore auth info - os.environ.update(auth_info) diff --git a/openstackclient/tests/functional/common/test_quota.py b/openstackclient/tests/functional/common/test_quota.py index 1b13e95e..76c69a4d 100644 --- a/openstackclient/tests/functional/common/test_quota.py +++ b/openstackclient/tests/functional/common/test_quota.py @@ -26,6 +26,7 @@ class QuotaTests(base.TestCase): @classmethod def setUpClass(cls): + super(QuotaTests, cls).setUpClass() cls.haz_network = base.is_service_enabled('network') cls.PROJECT_NAME =\ cls.get_openstack_configuration_value('auth.project_name') |
