fix: correct return type annotation for dbt_runner_freshness_success fixture#20903
Open
giulio-leone wants to merge 1 commit intoPrefectHQ:mainfrom
Open
fix: correct return type annotation for dbt_runner_freshness_success fixture#20903giulio-leone wants to merge 1 commit intoPrefectHQ:mainfrom
giulio-leone wants to merge 1 commit intoPrefectHQ:mainfrom
Conversation
…fixture The `dbt_runner_freshness_success` pytest fixture returns a `MagicMock` but was annotated as `-> None`. This causes type checkers (pyrefly, mypy) to flag the return statement and any downstream usage such as `dbt_runner_freshness_success.assert_called_with(...)` as a type error. Change the return annotation from `None` to `MagicMock` to match the actual return value. Fixes PrefectHQ#20732 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a type annotation mismatch in the Prefect dbt CLI test suite so static type checkers correctly understand what the dbt_runner_freshness_success pytest fixture returns.
Changes:
- Update
dbt_runner_freshness_successfixture return annotation fromNonetoMagicMock.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fixes #20732
The
dbt_runner_freshness_successpytest fixture intest_commands.pyreturns aMagicMockinstance but was annotated as-> None. This causes static type checkers (pyrefly, mypy, pyright) to flag:return _mock_dbt_runner_freshness_successstatement as returning a value from aNone-typed functiondbt_runner_freshness_success.assert_called_with(...)as calling a method onNoneChange
-> Noneto-> MagicMockon thedbt_runner_freshness_successfixture (line 259)Verification
MagicMockis already imported at the top of the file (from unittest.mock import MagicMock)dbt_runner_model_result,dbt_runner_ls_result,dbt_runner_freshness_error,dbt_runner_failed_result) correctly use-> Noneand are left unchangedtest_trigger_dbt_cli_command_cli_argument_listwhich calls.assert_called_with()on it