當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。