Skip to content

Remove dead code from airflow-core and task-sdk unit tests (non-db pass)#67694

Merged
shahar1 merged 2 commits into
apache:mainfrom
shahar1:remove-dead-test-code-airflow-core
May 29, 2026
Merged

Remove dead code from airflow-core and task-sdk unit tests (non-db pass)#67694
shahar1 merged 2 commits into
apache:mainfrom
shahar1:remove-dead-test-code-airflow-core

Conversation

@shahar1
Copy link
Copy Markdown
Contributor

@shahar1 shahar1 commented May 29, 2026

Removes test code that was never executed, identified by:

  1. Running pytest --cov=airflow-core/tests/unit/ -m "not db_test" and inspecting the JSON coverage report for callables with 0% body coverage.
  2. Cross-referencing with grep to distinguish db-test-only code (legitimately 0% in the non-db run) from truly unreachable code.

What was removed

File Removed
test_import_error.py permitted_dag_model fixture — never used as a param anywhere
test_task_instances.py one_task_with_single_mapped_ti fixture — never used
cli/conftest.py stream_capture, combined_capture fixtures + StreamCaptureManager, CombinedCaptureManager imports
test_plugins_manager.py mock_metadata_distribution fixture + import contextlib
test_info_command.py capture_show_output helper + from rich.console import Console
test_task_command.py move_back, _set_state_and_try_num helpers + import shutil, contextmanager
assets/test_manager.py create_mock_dag generator + import itertools
task-sdk/test_taskgroup.py test_taskgroup_getitem_returns_child_by_label — superseded

Coverage improvement (sample)

  • test_plugins_manager.py: 94% → 99% (body lines 61-71 removed)
  • cli/conftest.py: 74% → 85% (body lines 88-102 removed)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Sonnet 4.6 (Claude Code)

Generated-by: Claude Sonnet 4.6 (Claude Code) following the guidelines

Deleted fixtures, helpers, and an unused test that were identified
as never executed using pytest-cov coverage on the unit test suite
(confirmed with grep cross-referencing):

- `permitted_dag_model` fixture (test_import_error.py) — never used as a param
- `one_task_with_single_mapped_ti` fixture (test_task_instances.py) — never used
- `stream_capture` / `combined_capture` fixtures + their imports (cli/conftest.py) — never used
- `mock_metadata_distribution` fixture + `import contextlib` (test_plugins_manager.py) — never used
- `capture_show_output` helper + `from rich.console import Console` (test_info_command.py) — never called
- `move_back` / `_set_state_and_try_num` helpers + unused imports (test_task_command.py) — never called
- `create_mock_dag` generator + `import itertools` (assets/test_manager.py) — never called
- `test_taskgroup_getitem_returns_child_by_label` test (task-sdk) — superseded
@shahar1 shahar1 changed the title Remove dead code from unit tests (non-db pass) Remove dead code from airflow-core and task-sdk unit tests (non-db pass) May 29, 2026
@shahar1 shahar1 marked this pull request as draft May 29, 2026 09:02
@shahar1 shahar1 marked this pull request as ready for review May 29, 2026 09:03
Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I LOVE PRs that are removing code!

@shahar1 shahar1 added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label May 29, 2026
@shahar1 shahar1 merged commit 1247830 into apache:main May 29, 2026
221 of 229 checks passed
@shahar1 shahar1 deleted the remove-dead-test-code-airflow-core branch May 29, 2026 11:50
@github-actions github-actions Bot added this to the Airflow 3.2.3 milestone May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.2.3 based on: backport label targeting v3-2-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions
Copy link
Copy Markdown
Contributor

Backport failed to create: v3-2-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 1247830 v3-2-test

This should apply the commit to the v3-2-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

sunildataengineer pushed a commit to sunildataengineer/airflow that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants