Remove dead code from airflow-core and task-sdk unit tests (non-db pass)#67694
Conversation
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
jscheffl
left a comment
There was a problem hiding this comment.
Cool! I LOVE PRs that are removing code!
|
Hi maintainer, this PR was merged without a milestone set.
|
Backport failed to create: v3-2-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 1247830 v3-2-testThis should apply the commit to the v3-2-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
Removes test code that was never executed, identified by:
pytest --cov=airflow-core/tests/unit/ -m "not db_test"and inspecting the JSON coverage report for callables with 0% body coverage.grepto distinguish db-test-only code (legitimately 0% in the non-db run) from truly unreachable code.What was removed
test_import_error.pypermitted_dag_modelfixture — never used as a param anywheretest_task_instances.pyone_task_with_single_mapped_tifixture — never usedcli/conftest.pystream_capture,combined_capturefixtures +StreamCaptureManager,CombinedCaptureManagerimportstest_plugins_manager.pymock_metadata_distributionfixture +import contextlibtest_info_command.pycapture_show_outputhelper +from rich.console import Consoletest_task_command.pymove_back,_set_state_and_try_numhelpers +import shutil,contextmanagerassets/test_manager.pycreate_mock_daggenerator +import itertoolstask-sdk/test_taskgroup.pytest_taskgroup_getitem_returns_child_by_label— supersededCoverage 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?
Generated-by: Claude Sonnet 4.6 (Claude Code) following the guidelines