diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-04 15:18:25 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-05 23:46:02 -0500 |
| commit | 6fccdf4a285d5332ef49f23dc18c3ce45501d78b (patch) | |
| tree | d276e13e8960f00dc088c40908e4991248cc8639 /test/orm/inheritance/test_poly_loading.py | |
| parent | 640cd8a70f8a664b7834c5f74ec322fdea644043 (diff) | |
| download | sqlalchemy-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/orm/inheritance/test_poly_loading.py')
| -rw-r--r-- | test/orm/inheritance/test_poly_loading.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/orm/inheritance/test_poly_loading.py b/test/orm/inheritance/test_poly_loading.py index d7040e822..2f31ab0c4 100644 --- a/test/orm/inheritance/test_poly_loading.py +++ b/test/orm/inheritance/test_poly_loading.py @@ -16,6 +16,7 @@ from sqlalchemy.testing.assertsql import AllOf from sqlalchemy.testing.assertsql import CompiledSQL from sqlalchemy.testing.assertsql import EachOf from sqlalchemy.testing.assertsql import Or +from sqlalchemy.testing.fixtures import fixture_session from ._poly_fixtures import _Polymorphic from ._poly_fixtures import Company from ._poly_fixtures import Engineer @@ -145,7 +146,7 @@ class LoadBaseAndSubWEagerRelOpt( def test_load(self): A, B, ASub, C = self.classes("A", "B", "ASub", "C") - s = Session() + s = fixture_session() q = ( s.query(A) @@ -169,7 +170,7 @@ class LoadBaseAndSubWEagerRelMapped( def test_load(self): A, B, ASub, C = self.classes("A", "B", "ASub", "C") - s = Session() + s = fixture_session() q = ( s.query(A) @@ -182,7 +183,7 @@ class LoadBaseAndSubWEagerRelMapped( class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults): def test_person_selectin_subclasses(self): - s = Session() + s = fixture_session() q = s.query(Person).options( selectin_polymorphic(Person, [Engineer, Manager]) ) @@ -228,7 +229,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults): eq_(result, self.all_employees) def test_load_company_plus_employees(self): - s = Session() + s = fixture_session() q = ( s.query(Company) .options( @@ -316,7 +317,7 @@ class TestGeometries(GeometryFixtureBase): ) a, b, c, d, e = self.classes("a", "b", "c", "d", "e") - sess = Session() + sess = fixture_session() sess.add_all([d(d_data="d1"), e(e_data="e1")]) sess.commit() @@ -370,7 +371,7 @@ class TestGeometries(GeometryFixtureBase): ) a, b, c, d, e = self.classes("a", "b", "c", "d", "e") - sess = Session() + sess = fixture_session() sess.add_all([d(d_data="d1"), e(e_data="e1")]) sess.commit() @@ -420,7 +421,7 @@ class TestGeometries(GeometryFixtureBase): ) a, b, c, d, e = self.classes("a", "b", "c", "d", "e") - sess = Session() + sess = fixture_session() sess.add_all([d(d_data="d1"), e(e_data="e1")]) sess.commit() @@ -507,7 +508,7 @@ class TestGeometries(GeometryFixtureBase): ) a, a1, a2 = self.classes("a", "a1", "a2") - sess = Session() + sess = fixture_session() a1_obj = a1() a2_obj = a2() @@ -586,7 +587,7 @@ class LoaderOptionsTest( Parent, ChildSubclass1, Other = self.classes( "Parent", "ChildSubclass1", "Other" ) - session = Session(enable_baked_queries=enable_baked) + session = fixture_session(enable_baked_queries=enable_baked) def no_opt(): q = session.query(Parent).options( |
