holmuk commented on code in PR #65127:
URL: https://github.com/apache/airflow/pull/65127#discussion_r3071787305
##########
airflow-core/src/airflow/settings.py:
##########
@@ -434,6 +434,12 @@ def configure_orm(disable_connection_pool=False,
pool_class=None):
# Skip DB initialization in unit tests, if DB tests are skipped
Session = SkipDBTestsSession
engine = None
+
+ # Ensure all models are imported so SQLAlchemy can resolve
string-based relationships in tests.
+ from airflow.models import import_all_models
+
+ import_all_models()
Review Comment:
That's a workaround, but not really a solution - you suggest to perform
costly ORM initialization in non-DB mode. The root problem is that ORM-objects
are created during initialization even in non-DB mode right here:
https://github.com/apache/airflow/blob/bb5a744d4494d87817d641b02aa98278ea3a69b6/airflow-core/tests/unit/serialization/test_serialized_objects.py#L227-L250
The better solution would be to create these objects in tests via fixtures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]