当前位置: 首页>>代码示例>>Python>>正文


Python base.BaseTestCase方法代码示例

本文整理汇总了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)
        ) 
开发者ID:openstack,项目名称:oslo.db,代码行数:27,代码来源:test_fixtures.py

示例2: setUp

# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def setUp(self):
        super(BaseTestCase, self).setUp()
        self.addCleanup(CONF.reset) 
开发者ID:openstack,项目名称:zun,代码行数:5,代码来源:base.py

示例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') 
开发者ID:openstack,项目名称:ec2-api,代码行数:11,代码来源:base.py

示例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') 
开发者ID:openstack,项目名称:compute-hyperv,代码行数:29,代码来源:test.py

示例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) 
开发者ID:openstack,项目名称:magnum,代码行数:5,代码来源:base.py

示例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']) 
开发者ID:openstack,项目名称:oslo.cache,代码行数:12,代码来源:test_cache.py

示例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') 
开发者ID:openstack,项目名称:oslo.log,代码行数:12,代码来源:test_log.py

示例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' 
开发者ID:cloud-security-research,项目名称:sgx-kms,代码行数:7,代码来源:utils.py

示例9: tearDown

# 需要导入模块: from oslotest import base [as 别名]
# 或者: from oslotest.base import BaseTestCase [as 别名]
def tearDown(self):
        super(BaseTestCase, self).tearDown() 
开发者ID:cloud-security-research,项目名称:sgx-kms,代码行数:4,代码来源:utils.py

示例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' 
开发者ID:openstack,项目名称:python-barbicanclient,代码行数:6,代码来源:utils.py

示例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() 
开发者ID:openstack,项目名称:python-barbicanclient,代码行数:5,代码来源:base.py

示例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) 
开发者ID:openstack,项目名称:python-barbicanclient,代码行数:5,代码来源:base.py

示例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') 
开发者ID:openstack,项目名称:barbican,代码行数:7,代码来源:utils.py

示例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)
        ) 
开发者ID:openstack,项目名称:oslo.db,代码行数:43,代码来源:test_fixtures.py

示例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) 
开发者ID:openstack,项目名称:oslo.db,代码行数:6,代码来源:utils.py


注:本文中的oslotest.base.BaseTestCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。