refactor: Convert test_cloud.py from unittest mock.patch to pytest mocker#498
Open
refactor: Convert test_cloud.py from unittest mock.patch to pytest mocker#498
Conversation
Co-authored-by: blackboxsw <14128326+blackboxsw@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor tests from unittest to pytest in test_helpers.py
refactor: Convert test_cloud.py from unittest mock.patch to pytest mocker
Jan 13, 2026
Collaborator
|
@copilot Please increment to pyclodulib semantic PATCH version in pycloudlib/VERSION and ensure all github workflows pass |
Co-authored-by: blackboxsw <14128326+blackboxsw@users.noreply.github.com>
Author
Done. Version incremented to 1!10.16.1 in commit 2a683f1. All GitHub workflows pass:
|
blackboxsw
approved these changes
Jan 13, 2026
Collaborator
blackboxsw
left a comment
There was a problem hiding this comment.
@copilot Looks good to me, in the future, we'd like to see a single squashed commit for unittest changes for this type of refactor.
Acceptance criteria:
- Each commit must use conventional commits for the commit summary
- Each test commit shall contain a footer
Fixes GH-<issue_num>
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.
Description
Converted
tests/unit_tests/test_cloud.pyfrom unittest-style mocking to pytest-style using themockerfixture frompytest-mock, and incremented the package version.Changes Made
mockimport and@mock.patchdecorators: Replaced all 7 test methods using@mock.patchdecorators withmocker.patch()calls inside test functionsmockerfixture parameter to affected tests, removed decorator-injected mock parameters1!10.16.0to1!10.16.1Example
Before:
After:
Additional Context and Relevant Issues
Part of broader effort to standardize test patterns across the codebase. No behavior changes—all 319 unit tests pass. All GitHub workflows validated (ruff, mypy, pytest, docs, version_check).
Test Steps
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.