summaryrefslogtreecommitdiff
path: root/test/ext/declarative/test_basic.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-03-07 19:17:07 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2020-03-07 17:50:45 -0500
commiteda6dbbf387def2063d1b6719b64b20f9e7f2ab4 (patch)
tree4af5f41edfac169b0fdc6d6cab0fce4e8bf776cf /test/ext/declarative/test_basic.py
parent851fb8f5a661c66ee76308181118369c8c4df9e0 (diff)
downloadsqlalchemy-eda6dbbf387def2063d1b6719b64b20f9e7f2ab4.tar.gz
Simplified module pre-loading strategy and made it linter friendly
Introduced a modules registry to register modules that should be lazily loaded in the package init. This ensures that they are in the system module cache, avoiding potential thread safety issues as when importing them directly in the function that uses them. The module registry is used to obtain these modules directly, ensuring that the all the lazily loaded modules are resolved at the proper time This replaces dependency_for decorator and the dependencies decorator logic, removing the need to pass the resolved modules as arguments of the decodated functions and removes possible errors caused by linters. Fixes: #4689 Fixes: #4656 Change-Id: I2e291eba4297867fc0ddb5d875b9f7af34751d01
Diffstat (limited to 'test/ext/declarative/test_basic.py')
-rw-r--r--test/ext/declarative/test_basic.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py
index 935e6f431..d81b99ccd 100644
--- a/test/ext/declarative/test_basic.py
+++ b/test/ext/declarative/test_basic.py
@@ -26,10 +26,10 @@ from sqlalchemy.orm import composite
from sqlalchemy.orm import configure_mappers
from sqlalchemy.orm import create_session
from sqlalchemy.orm import deferred
+from sqlalchemy.orm import descriptor_props
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.orm import joinedload
from sqlalchemy.orm import mapper
-from sqlalchemy.orm import properties
from sqlalchemy.orm import relationship
from sqlalchemy.orm import Session
from sqlalchemy.orm.events import MapperEvents
@@ -1144,7 +1144,7 @@ class DeclarativeTest(DeclarativeTestBase):
assert ASub.brap.property is A.data.property
assert isinstance(
- ASub.brap.original_property, properties.SynonymProperty
+ ASub.brap.original_property, descriptor_props.SynonymProperty
)
def test_alt_name_attr_subclass_relationship_inline(self):
@@ -1166,7 +1166,7 @@ class DeclarativeTest(DeclarativeTestBase):
assert ASub.brap.property is A.b.property
assert isinstance(
- ASub.brap.original_property, properties.SynonymProperty
+ ASub.brap.original_property, descriptor_props.SynonymProperty
)
ASub(brap=B())
@@ -1179,7 +1179,9 @@ class DeclarativeTest(DeclarativeTestBase):
A.brap = A.data
assert A.brap.property is A.data.property
- assert isinstance(A.brap.original_property, properties.SynonymProperty)
+ assert isinstance(
+ A.brap.original_property, descriptor_props.SynonymProperty
+ )
def test_alt_name_attr_subclass_relationship_attrset(self):
# [ticket:2900]
@@ -1196,7 +1198,9 @@ class DeclarativeTest(DeclarativeTestBase):
id = Column("id", Integer, primary_key=True)
assert A.brap.property is A.b.property
- assert isinstance(A.brap.original_property, properties.SynonymProperty)
+ assert isinstance(
+ A.brap.original_property, descriptor_props.SynonymProperty
+ )
A(brap=B())
def test_eager_order_by(self):