summaryrefslogtreecommitdiff
path: root/test/ext/declarative/test_inheritance.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-01-04 15:18:25 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-01-05 23:46:02 -0500
commit6fccdf4a285d5332ef49f23dc18c3ce45501d78b (patch)
treed276e13e8960f00dc088c40908e4991248cc8639 /test/ext/declarative/test_inheritance.py
parent640cd8a70f8a664b7834c5f74ec322fdea644043 (diff)
downloadsqlalchemy-6fccdf4a285d5332ef49f23dc18c3ce45501d78b.tar.gz
remove more bound metadata
in Iae6ab95938a7e92b6d42086aec534af27b5577d3 I missed that the "bind" was being stuck onto the MetaData in TablesTest, which led thousands of ORM tests to still use bound metadata. Keep looking for bound metadata. standardize all ORM tests on a single means of getting a Session when the Session API isn't the thing we are directly testing, using a new function fixture_session() that replaces create_session() and uses modern defaults. Change-Id: Iaf71206e9ee568151496d8bc213a069504bf65ef
Diffstat (limited to 'test/ext/declarative/test_inheritance.py')
-rw-r--r--test/ext/declarative/test_inheritance.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ext/declarative/test_inheritance.py b/test/ext/declarative/test_inheritance.py
index 77d4a80fe..2b80b753e 100644
--- a/test/ext/declarative/test_inheritance.py
+++ b/test/ext/declarative/test_inheritance.py
@@ -10,7 +10,6 @@ from sqlalchemy.ext.declarative import has_inherited_table
from sqlalchemy.orm import clear_mappers
from sqlalchemy.orm import close_all_sessions
from sqlalchemy.orm import configure_mappers
-from sqlalchemy.orm import create_session
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.orm import polymorphic_union
from sqlalchemy.orm import relationship
@@ -19,6 +18,7 @@ from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import mock
+from sqlalchemy.testing.fixtures import fixture_session
from sqlalchemy.testing.schema import Column
from sqlalchemy.testing.schema import Table
from test.orm.test_events import _RemoveListeners
@@ -34,7 +34,7 @@ class DeclarativeTestBase(fixtures.TestBase, testing.AssertsExecutionResults):
def teardown(self):
close_all_sessions()
clear_mappers()
- Base.metadata.drop_all()
+ Base.metadata.drop_all(testing.db)
class ConcreteInhTest(
@@ -49,8 +49,8 @@ class ConcreteInhTest(
polymorphic=True,
explicit_type=False,
):
- Base.metadata.create_all()
- sess = create_session()
+ Base.metadata.create_all(testing.db)
+ sess = fixture_session()
e1 = Engineer(name="dilbert", primary_language="java")
e2 = Engineer(name="wally", primary_language="c++")
m1 = Manager(name="dogbert", golf_swing="fore!")
@@ -342,7 +342,7 @@ class ConcreteInhTest(
"concrete": True,
}
- Base.metadata.create_all()
+ Base.metadata.create_all(testing.db)
sess = Session()
sess.add(Engineer(name="d"))
sess.commit()
@@ -552,7 +552,7 @@ class ConcreteExtensionConfigTest(
c_data = Column(String(50))
__mapper_args__ = {"polymorphic_identity": "c", "concrete": True}
- Base.metadata.create_all()
+ Base.metadata.create_all(testing.db)
sess = Session()
sess.add_all(
[