summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_compiler.py9
-rw-r--r--test/dialect/postgresql/test_types.py8
2 files changed, 8 insertions, 9 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index 0b56d8987..5ada6f592 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -41,7 +41,7 @@ from sqlalchemy.dialects.postgresql import TSRANGE
from sqlalchemy.dialects.postgresql.base import PGDialect
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
from sqlalchemy.orm import aliased
-from sqlalchemy.orm import mapper
+from sqlalchemy.orm import clear_mappers
from sqlalchemy.orm import Session
from sqlalchemy.sql import column
from sqlalchemy.sql import literal_column
@@ -2728,7 +2728,7 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL):
)
-class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL):
+class DistinctOnTest(fixtures.MappedTest, AssertsCompiledSQL):
"""Test 'DISTINCT' with SQL expression language and orm.Query with
an emphasis on PG's 'DISTINCT ON' syntax.
@@ -2825,7 +2825,8 @@ class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL):
class Foo(object):
pass
- mapper(Foo, self.table)
+ clear_mappers()
+ self.mapper_registry.map_imperatively(Foo, self.table)
sess = Session()
subq = sess.query(Foo).subquery()
@@ -2842,7 +2843,7 @@ class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL):
class Foo(object):
pass
- mapper(Foo, self.table)
+ self.mapper_registry.map_imperatively(Foo, self.table)
a1 = aliased(Foo)
sess = Session()
self.assert_compile(
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index bb8e44876..92641fcc6 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -3034,17 +3034,15 @@ class HStoreRoundTripTest(fixtures.TablesTest):
)
self._assert_data([{r"key \"foo\"": r'value \"bar"\ xyz'}], connection)
- def test_orm_round_trip(self, connection):
- from sqlalchemy import orm
-
+ def test_orm_round_trip(self, registry):
class Data(object):
def __init__(self, name, data):
self.name = name
self.data = data
- orm.mapper(Data, self.tables.data_table)
+ registry.map_imperatively(Data, self.tables.data_table)
- with orm.Session(connection) as s:
+ with fixtures.fixture_session() as s:
d = Data(
name="r1",
data={"key1": "value1", "key2": "value2", "key3": "value3"},