Skip to content

Fix Azure Data Factory async test on azure-mgmt-datafactory 10#69798

Merged
jason810496 merged 1 commit into
apache:mainfrom
jason810496:fix/azure/data-factory-pipeline-run-mock
Jul 13, 2026
Merged

Fix Azure Data Factory async test on azure-mgmt-datafactory 10#69798
jason810496 merged 1 commit into
apache:mainfrom
jason810496:fix/azure/data-factory-pipeline-run-mock

Conversation

@jason810496

Copy link
Copy Markdown
Member

Why

TestAzureDataFactoryAsyncHook::test_get_pipeline_run_exception_without_resource fails on main in the uncapped-dependency CI jobs with ModuleNotFoundError: No module named 'azure.mgmt.datafactory.models._models_py3' — the regenerated azure-mgmt-datafactory 10.0.0 removed that private module, and the test mock.patches a class inside it at run time (#69785 fixed the collection-time break in the same file, but this run-time patch was left behind).

What

  • Drop the @mock.patch("azure.mgmt.datafactory.models._models_py3.PipelineRun") decorator and use a plain MagicMock() as the mocked pipeline_runs.get return value. The value is an opaque placeholder — the test asserts get_pipeline_run raises before the connection is ever used — so the test no longer depends on any specific SDK module layout and passes on both 9.3.0 (locked) and 10.0.0.

Verification

  • uv run --project providers/microsoft/azure --with "azure-mgmt-datafactory==10.0.0" pytest providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_data_factory.py -q → 78 passed (the unfixed test fails on 10.0.0 with the CI error)
  • uv run --project providers/microsoft/azure pytest providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_data_factory.py -q → 78 passed on locked 9.3.0

Was generative AI tooling used to co-author this PR?

The test patched the private module azure.mgmt.datafactory.models._models_py3,
which the regenerated azure-mgmt-datafactory 10.0.0 removed, so mock.patch
raised ModuleNotFoundError in the uncapped-dependency CI jobs on main. The
mocked PipelineRun was only an opaque placeholder for the mocked
pipeline_runs.get return value - the test asserts the exception is raised
before the connection is ever used - so a neutral MagicMock removes the
dependency on any specific SDK module layout. Follow-up to apache#69785, which
fixed the collection-time break in the same file.
@jason810496 jason810496 self-assigned this Jul 13, 2026
@jason810496
jason810496 merged commit adc16e0 into apache:main Jul 13, 2026
82 checks passed
@jason810496
jason810496 deleted the fix/azure/data-factory-pipeline-run-mock branch July 13, 2026 05:50
joshuabvarghese pushed a commit to joshuabvarghese/airflow that referenced this pull request Jul 16, 2026
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.

2 participants