fix(infra): correct mock.patch target for build_image_impl in helper_test#15840
Open
Ravi-Dahiya-00 wants to merge 1 commit into
Open
fix(infra): correct mock.patch target for build_image_impl in helper_test#15840Ravi-Dahiya-00 wants to merge 1 commit into
Ravi-Dahiya-00 wants to merge 1 commit into
Conversation
Author
Contributor
|
Do not ping random users. It's incredible rude. (I'm not a maintainer of this project at all.) |
Author
Sorry, dude. It was just a mistake. I thought you were a maintainer because you have such an awesome profile, man. 😅 |
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.
What changed
In
ShellTest.test_base_runner_debuginsideinfra/helper_test.py, the mock decorator was incorrectly targetinghelper.build_image_impl:Why it was wrong
build_image_implis defined incommon_utils.py, not inhelper.py.Python's
unittest.mock.patchworks by replacing the name at the location where it is defined (or where it is imported and used). Sincehelper.build_image_impldoes not exist as a name in thehelpermodule, the patch had no effect — the realbuild_image_implfunction was being called silently during the test, making it neither a true unit test nor reliable in environments without Docker.Impact
test_base_runner_debugwas not actually isolating the unit under test.build_image_impl(e.g., Docker calls) could cause non-deterministic failures in CI.No functional changes
Only the test file is modified. No production code is affected.