Merge "Replace use of testtools.testcase.TestSkipped"

This commit is contained in:
Zuul 2024-09-13 13:38:21 +00:00 committed by Gerrit Code Review
commit c6e7b4abbc
2 changed files with 7 additions and 5 deletions

View File

@ -18,7 +18,9 @@ Functional test cases for the Barbican key manager.
Note: This requires local running instances of Barbican and Keystone. Note: This requires local running instances of Barbican and Keystone.
""" """
import abc import abc
import unittest
from keystoneauth1 import identity from keystoneauth1 import identity
from keystoneauth1 import session from keystoneauth1 import session
@ -26,7 +28,6 @@ from oslo_config import cfg
from oslo_context import context from oslo_context import context
from oslo_utils import uuidutils from oslo_utils import uuidutils
from oslotest import base from oslotest import base
from testtools import testcase
from castellan.common.credentials import keystone_password from castellan.common.credentials import keystone_password
from castellan.common.credentials import keystone_token from castellan.common.credentials import keystone_token
@ -59,7 +60,7 @@ class BarbicanKeyManagerTestCase(test_key_manager.KeyManagerTestCase):
except Exception as e: except Exception as e:
# When we run functional-vault target, This test class needs # When we run functional-vault target, This test class needs
# to be skipped as barbican is not running # to be skipped as barbican is not running
raise testcase.TestSkipped(str(e)) raise unittest.SkipTest(str(e))
def tearDown(self): def tearDown(self):
super(BarbicanKeyManagerTestCase, self).tearDown() super(BarbicanKeyManagerTestCase, self).tearDown()

View File

@ -15,14 +15,15 @@ Functional test cases for the Vault key manager.
Note: This requires local running instance of Vault. Note: This requires local running instance of Vault.
""" """
import os import os
import unittest
import uuid import uuid
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils
from oslotest import base from oslotest import base
import requests import requests
from testtools import testcase
from castellan.common import exception from castellan.common import exception
from castellan.key_manager import vault_key_manager from castellan.key_manager import vault_key_manager
@ -39,7 +40,7 @@ class VaultKeyManagerTestCase(test_key_manager.KeyManagerTestCase,
if ('VAULT_TEST_URL' not in os.environ or if ('VAULT_TEST_URL' not in os.environ or
'VAULT_TEST_ROOT_TOKEN' not in os.environ): 'VAULT_TEST_ROOT_TOKEN' not in os.environ):
raise testcase.TestSkipped('Missing Vault setup information') raise unittest.SkipTest('Missing Vault setup information')
key_mgr._root_token_id = os.environ['VAULT_TEST_ROOT_TOKEN'] key_mgr._root_token_id = os.environ['VAULT_TEST_ROOT_TOKEN']
key_mgr._vault_url = os.environ['VAULT_TEST_URL'] key_mgr._vault_url = os.environ['VAULT_TEST_URL']
@ -90,7 +91,7 @@ class VaultKeyManagerAppRoleTestCase(VaultKeyManagerTestCase):
if ('VAULT_TEST_URL' not in os.environ or if ('VAULT_TEST_URL' not in os.environ or
'VAULT_TEST_ROOT_TOKEN' not in os.environ): 'VAULT_TEST_ROOT_TOKEN' not in os.environ):
raise testcase.TestSkipped('Missing Vault setup information') raise unittest.SkipTest('Missing Vault setup information')
self.root_token_id = os.environ['VAULT_TEST_ROOT_TOKEN'] self.root_token_id = os.environ['VAULT_TEST_ROOT_TOKEN']
self.vault_url = os.environ['VAULT_TEST_URL'] self.vault_url = os.environ['VAULT_TEST_URL']