Debian Codegraph @

oslo_db/tests/sqlalchemy/base.py

raw symbols SCIP
1 # Copyright (c) 2016 Openstack Foundation
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from oslo_db.sqlalchemy import enginefacade
17 from oslo_db.sqlalchemy.test_base import backend_specific # noqa
18 from oslo_db.sqlalchemy import test_fixtures as db_fixtures
19 from oslo_db.tests import base as test_base
20
21
22 @enginefacade.transaction_context_provider
23 class Context:
24 pass
25
26
27 context = Context()
28
29
30 # NOTE (zzzeek) These test classes are **private to oslo.db**. Please
31 # make use of oslo_db.sqlalchemy.test_fixtures directly.
32
33 class _DbTestCase(
34 db_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase,
35 ):
36
37 def setUp(self):
38 super().setUp()
39
40 self.engine = enginefacade.writer.get_engine()
41 self.sessionmaker = enginefacade.writer.get_sessionmaker()
42
43
44 class _MySQLOpportunisticTestCase(_DbTestCase):
45 FIXTURE = db_fixtures.MySQLOpportunisticFixture
46
47
48 class _PostgreSQLOpportunisticTestCase(_DbTestCase):
49 FIXTURE = db_fixtures.PostgresqlOpportunisticFixture