# Path: oslo_db/concurrency.py
# LOG = logging.getLogger(__name__)
# class TpoolDbapiWrapper(object):
#     def __init__(self, conf, backend_mapping):
#     def _api(self):
#     def __getattr__(self, key):
# def list_opts():
# 
# Path: oslo_db/tests/base.py
# class BaseTestCase(base.BaseTestCase):
#     def setUp(self):


import sys
from unittest import mock
from oslo_config import fixture as config_fixture
from oslo_db import concurrency
from oslo_db.tests import base as test_base
        #     eventlet is installed
        # expected result:
        #     TpoolDbapiWrapper should wrap DBAPI

        fake_db_api = mock.MagicMock()
        mock_db_api.from_config.return_value = fake_db_api

        # get access to some db-api method
        self.db_api.fake_call_1

        mock_db_api.from_config.assert_called_once_with(
            conf=self.conf, backend_mapping=FAKE_BACKEND_MAPPING)
        self.assertEqual(fake_db_api, self.db_api._db_api)
        self.assertFalse(self.eventlet.tpool.Proxy.called)

        # get access to other db-api method to be sure that api didn't changed
        self.db_api.fake_call_2

        self.assertEqual(fake_db_api, self.db_api._db_api)
        self.assertFalse(self.eventlet.tpool.Proxy.called)
        self.assertEqual(1, mock_db_api.from_config.call_count)

    @mock.patch('oslo_db.api.DBAPI')
    def test_db_api_config_change(self, mock_db_api):
        # test context:
        #     CONF.database.use_tpool == True
        #     eventlet is installed
        # expected result:
        #     TpoolDbapiWrapper should wrap tpool proxy


# Path: oslo_db/concurrency.py
# LOG = logging.getLogger(__name__)
# class TpoolDbapiWrapper(object):
#     def __init__(self, conf, backend_mapping):
#     def _api(self):
#     def __getattr__(self, key):
# def list_opts():
# 
# Path: oslo_db/tests/base.py
# class BaseTestCase(base.BaseTestCase):
#     def setUp(self):


# Path: oslo_db/tests/test_concurrency.py
import sys
from unittest import mock
from oslo_config import fixture as config_fixture
from oslo_db import concurrency
from oslo_db.tests import base as test_base

        #     eventlet is installed
        # expected result:
        #     TpoolDbapiWrapper should wrap DBAPI

        fake_db_api = mock.MagicMock()
        mock_db_api.from_config.return_value = fake_db_api

        # get access to some db-api method
        self.db_api.fake_call_1

        mock_db_api.from_config.assert_called_once_with(
            conf=self.conf, backend_mapping=FAKE_BACKEND_MAPPING)
        self.assertEqual(fake_db_api, self.db_api._db_api)
        self.assertFalse(self.eventlet.tpool.Proxy.called)

        # get access to other db-api method to be sure that api didn't changed
        self.db_api.fake_call_2

        self.assertEqual(fake_db_api, self.db_api._db_api)
        self.assertFalse(self.eventlet.tpool.Proxy.called)
        self.assertEqual(1, mock_db_api.from_config.call_count)

    @mock.patch('oslo_db.api.DBAPI')
    def test_db_api_config_change(self, mock_db_api):
        # test context:
        #     CONF.database.use_tpool == True
        #     eventlet is installed
        # expected result:
        #     TpoolDbapiWrapper should wrap tpool proxy


        fake_db_api = mock.MagicMock()