Add unit tests for info_* helper functions with mocked subprocess and file I/O#115
Merged
gsanchietti merged 2 commits intoissue1512from Feb 11, 2026
Merged
Add unit tests for info_* helper functions with mocked subprocess and file I/O#115gsanchietti merged 2 commits intoissue1512from
gsanchietti merged 2 commits intoissue1512from
Conversation
Co-authored-by: gsanchietti <804596+gsanchietti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] WIP address feedback from review on extra info in inventory
Add unit tests for info_* helper functions with mocked subprocess and file I/O
Feb 11, 2026
gsanchietti
approved these changes
Feb 11, 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.
Addresses review feedback requesting test coverage for the
info_*helper functions introduced in #113. These functions gather system information via subprocess calls and/procreads but lacked unit tests.Changes
File I/O tests: Mock
/proc/versionand/proc/uptimereads forinfo_kernel_version()andinfo_uptime_seconds()with exception handlingIPv4/IPv6 detection tests: Mock
subprocess.runfor all three fallback methods ininfo_default_ipv4()(dig → curl → ip command) andinfo_default_ipv6()with early-exit validationUpdate checking tests: Mock subprocess calls to
/usr/libexec/rpcd/ns.updateforinfo_package_updates_available()andinfo_image_updates_available()Version parsing tests: Validate
parse_version()handles prefix removal, comparison operators, and invalid inputAll tests use
unittest.mock.patchandmock_opento isolate system dependencies. 17 new tests covering success paths, fallback chains, and failure modes.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.