diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46d505f55ab68..36db9d1ecda48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -413,6 +413,7 @@ repos: ^airflow-ctl.*\.py$| ^airflow-core/src/airflow/models/.*\.py$| ^airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py$| + ^airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py$| ^providers/openlineage/.*\.py$| ^task_sdk.*\.py$ pass_filenames: true diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py index ca48080c3a0ec..a37419adae488 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py @@ -137,11 +137,8 @@ def test_should_respond_200_version(self, test_client, accept, session, test_dag # force reserialization test_dag.doc_md = "new doc" force_reserialization(test_dag.dag_id, "dag-folder") - dagcode = ( - session.query(DagCode) - .filter(DagCode.fileloc == test_dag.fileloc) - .order_by(DagCode.id.desc()) - .first() + dagcode = session.scalar( + select(DagCode).where(DagCode.fileloc == test_dag.fileloc).order_by(DagCode.id.desc()).limit(1) ) assert dagcode.dag_version.version_number == 2 # populate the latest dagcode with a value