本文整理汇总了Python中oslotest.base.BaseTestCase方法的典型用法代码示例。如果您正苦于以下问题:Python base.BaseTestCase方法的具体用法?Python base.BaseTestCase怎么用?Python base.BaseTestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oslotest.base
的用法示例。
在下文中一共展示了base.BaseTestCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_skip_no_such_backend
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def test_skip_no_such_backend(self):
class FakeDatabaseOpportunisticFixture(
test_fixtures.OpportunisticDbFixture):
DRIVER = 'postgresql+nosuchdbapi'
class SomeTest(test_fixtures.OpportunisticDBTestMixin,
oslo_test_base.BaseTestCase):
FIXTURE = FakeDatabaseOpportunisticFixture
def runTest(self):
pass
st = SomeTest()
ex = self.assertRaises(
self.skipException,
st.setUp
)
self.assertEqual(
"Backend 'postgresql+nosuchdbapi' is unavailable: No such backend",
str(ex)
)
示例2: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.addCleanup(CONF.reset)
示例3: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self._conf = self.useFixture(config_fixture.Config())
self.configure(fatal_exception_format_errors=True)
lock_path = self.useFixture(fixtures.TempDir()).path
self.fixture = self.useFixture(
config_fixture.Config(lockutils.CONF))
self.fixture.config(lock_path=lock_path,
group='oslo_concurrency')
示例4: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
"""Run before each test method to initialize test environment."""
# Ensure BaseTestCase's ConfigureLogging fixture is disabled since
# we're using the one from Nova (StandardLogging).
with fixtures.EnvironmentVariable('OS_LOG_CAPTURE', '0'):
super(NoDBTestCase, self).setUp()
self.useFixture(mock_fixture.MockAutospecFixture())
self.useFixture(log_fixture.get_logging_handle_error_fixture())
self.useFixture(nova_fixtures.StandardLogging())
self.useFixture(conf_fixture.ConfFixture(CONF))
# NOTE(blk-u): WarningsFixture must be after the Database fixture
# because sqlalchemy-migrate messes with the warnings filters.
self.useFixture(nova_fixtures.WarningsFixture())
self.addCleanup(self._clear_attrs)
self.policy = self.useFixture(policy_fixture.PolicyFixture())
self.useFixture(nova_fixtures.PoisonFunctions())
if self.MOCK_TOOZ:
self.patch('compute_hyperv.nova.coordination.Coordinator.start')
self.patch('compute_hyperv.nova.coordination.Coordinator.stop')
self.patch('compute_hyperv.nova.coordination.Coordinator.get_lock')
示例5: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.addCleanup(cfg.CONF.reset)
示例6: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.config_fixture = self.useFixture(config_fixture.Config())
self.config_fixture.config(
# TODO(morganfainberg): Make Cache Testing a separate test case
# in tempest, and move it out of the base unit tests.
group='cache',
backend='dogpile.cache.memory',
enabled=True,
proxies=['oslo_cache.testing.CacheIsolatingProxy'])
示例7: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.context_fixture = self.useFixture(
fixture_context.ClearRequestContext())
self.config_fixture = self.useFixture(
fixture_config.Config(cfg.ConfigOpts()))
self.config = self.config_fixture.config
self.CONF = self.config_fixture.conf
log.register_options(self.CONF)
log.setup(self.CONF, 'base')
示例8: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.order_id = 'order1234'
self.external_project_id = 'keystone1234'
self.request_id = 'request1234'
示例9: tearDown
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def tearDown(self):
super(BaseTestCase, self).tearDown()
示例10: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
super(BaseTestCase, self).setUp()
self.order_id = 'order1234'
self.external_project_id = 'keystone1234'
示例11: setUpClass
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUpClass(cls):
cls.LOG = logging.getLogger(cls._get_full_case_name())
super(BaseTestCase, cls).setUpClass()
示例12: tearDown
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def tearDown(self):
super(BaseTestCase, self).tearDown()
self.LOG.info('Finished: %s\n', self._testMethodName)
示例13: tearDown
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def tearDown(self):
super(BaseTestCase, self).tearDown()
ss_conf = config.get_module_config('secretstore')
ss_conf.clear_override("enable_multiple_secret_stores",
group='secretstore')
示例14: test_skip_no_dbapi
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def test_skip_no_dbapi(self):
class FakeDatabaseOpportunisticFixture(
test_fixtures.OpportunisticDbFixture):
DRIVER = 'postgresql'
class SomeTest(test_fixtures.OpportunisticDBTestMixin,
oslo_test_base.BaseTestCase):
FIXTURE = FakeDatabaseOpportunisticFixture
def runTest(self):
pass
st = SomeTest()
# patch in replacement lookup dictionaries to avoid
# leaking from/to other tests
with mock.patch(
"oslo_db.sqlalchemy.provision."
"Backend.backends_by_database_type", {
"postgresql":
provision.Backend("postgresql", "postgresql://")}):
st._database_resources = {}
st._db_not_available = {}
st._schema_resources = {}
with mock.patch(
"sqlalchemy.create_engine",
mock.Mock(side_effect=ImportError())):
self.assertEqual([], st.resources)
ex = self.assertRaises(
self.skipException,
st.setUp
)
self.assertEqual(
"Backend 'postgresql' is unavailable: No DBAPI installed",
str(ex)
)
示例15: setUp
# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self, conf=cfg.CONF):
super(BaseTestCase, self).setUp()
self.conf = conf
self.addCleanup(self.conf.reset)