Copilot commented on code in PR #65313:
URL: https://github.com/apache/airflow/pull/65313#discussion_r3100245052
##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1344,12 +1429,16 @@ def process_parse_results(
bundle_name: str,
bundle_version: str | None,
parsing_result: DagFileParsingResult | None,
- session: Session,
*,
is_callback_only: bool = False,
relative_fileloc: str | None = None,
Review Comment:
`process_parse_results` still accepts `bundle_version`, but it is no longer
used inside the function after persistence was extracted. To avoid confusion
(and to keep linters/type-checkers happy), either remove this parameter from
the function signature and its call sites, or rename it to `_bundle_version` to
explicitly mark it as intentionally unused.
##########
airflow-core/tests/unit/dag_processing/test_processor.py:
##########
@@ -702,6 +699,42 @@ def test_import_error_updates_timestamps(session):
assert stat.import_errors == 1
+def test_persist_parsing_result_calls_update_db():
+ """persist_parsing_result should delegate to
update_dag_parsing_results_in_db with transformed args."""
+ parsing_result = DagFileParsingResult(
+ fileloc="test.py",
+ serialized_dags=[],
+ import_errors={"dags/broken.py": "SyntaxError"},
+ warnings=[],
+ )
+
+ manager = MagicMock(spec=DagFileProcessorManager)
+ session = MagicMock()
+ # Call the real method on the mock instance
+ with patch(
Review Comment:
`session = MagicMock()` is created without a `spec`/`autospec`, which makes
the test less strict and can hide attribute/method typos. Consider using a spec
(e.g. a SQLAlchemy `Session` or a minimal protocol) or a real session fixture
if appropriate for this unit test.
--
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]