Fix Azure Data Factory async test on azure-mgmt-datafactory 10#69798
Merged
jason810496 merged 1 commit intoJul 13, 2026
Merged
Conversation
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.
amoghrajesh
approved these changes
Jul 13, 2026
1 task
joshuabvarghese
pushed a commit
to joshuabvarghese/airflow
that referenced
this pull request
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TestAzureDataFactoryAsyncHook::test_get_pipeline_run_exception_without_resourcefails on main in the uncapped-dependency CI jobs withModuleNotFoundError: No module named 'azure.mgmt.datafactory.models._models_py3'— the regeneratedazure-mgmt-datafactory10.0.0 removed that private module, and the testmock.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
@mock.patch("azure.mgmt.datafactory.models._models_py3.PipelineRun")decorator and use a plainMagicMock()as the mockedpipeline_runs.getreturn value. The value is an opaque placeholder — the test assertsget_pipeline_runraises 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.0Was generative AI tooling used to co-author this PR?