Skip to content

Align standard provider empty and external_task tests with expected paths - #73267

Open
keith991001 wants to merge 2 commits into
apache:mainfrom
keith991001:add-standard-empty-external-task-tests
Open

keith991001 wants to merge 2 commits into
apache:mainfrom
keith991001:add-standard-empty-external-task-tests

Conversation

@keith991001

Copy link
Copy Markdown
Contributor

Resolves two OVERLOOKED_TESTS entries for the standard provider, following the per-provider batching convention (same shape as #73111 / #73153 / #73229).

What changed

sensors/test_external_task.py — the coverage already existed (2400+ lines) but under the legacy name test_external_task_sensor.py, so the guard list kept treating the mirror-path test as missing (the stale entry was never caught because of the added_test_files type mismatch that #71985 fixes). Renamed via git mv to mirror the source module external_task.py, matching the earlier branch/latest_only alignment in #73229.

While moving, added a TestExternalDagLink class — the ExternalDagLink operator link had no dedicated coverage: its name, and the exact dag-run URL it builds, asserted for both operators that declare it (ExternalTaskSensor and ExternalTaskMarker).

operators/test_empty.py — new file. EmptyOperator is 39 lines of source but carries a scheduler-facing contract worth pinning:

  • execute is a no-op returning None;
  • inherits_from_empty_operator is True on class and instance;
  • the scheduler short-circuit contract via TaskInstance.is_task_schedulable (3.2+ guarded): a trivial EmptyOperator is marked success without being scheduled, while on_execute_callback / on_success_callback / outlets / inlets each opt the task back into real scheduling.

Both entries removed from OVERLOOKED_TESTS in test_project_structure.py.

Verification

  • pytest providers/standard/tests/unit/standard/operators/test_empty.py → 7 passed
  • pytest providers/standard/tests/unit/standard/sensors/test_external_task.py → 42 passed, 65 skipped (pre-existing version-gated skips, unchanged by the move)
  • pytest airflow-core/tests/unit/always/test_project_structure.py → 10 passed, 1 xfailed
  • local providers mypy and prek run --from-ref main clean

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Fable 5) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

…aths

Two OVERLOOKED_TESTS entries in the standard provider are resolved:

- providers/standard/tests/.../sensors/test_external_task.py existed as
  test_external_task_sensor.py, so the guard list kept treating the
  mirror-path test as missing. Rename the file to match the source
  module path (external_task.py), same as the earlier branch/latest_only
  alignment. While moving, add a TestExternalDagLink class: the
  ExternalDagLink operator link had no coverage for its name or the
  URL it builds for either operator that declares it.

- providers/standard/tests/.../operators/test_empty.py did not exist.
  Add it, covering the no-op execute, the inherits_from_empty_operator
  marker, and the scheduler short-circuit contract
  (TaskInstance.is_task_schedulable): a trivial EmptyOperator is marked
  success without being scheduled, while callbacks/outlets/inlets opt
  a task back into real scheduling.

Both entries are removed from OVERLOOKED_TESTS.
The check-no-new-airflow-exceptions allowlist is keyed by file path, so
the renamed test_external_task.py inherited a zero quota while its one
pre-existing raise AirflowException usage moved with the file.
Regenerated with check_new_airflow_exception_usage.py --generate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant