test: add unit tests for utility modules#309
test: add unit tests for utility modules#309Tyrrnien81 wants to merge 2 commits intorobotmcp:developfrom
Conversation
samkwak188
left a comment
There was a problem hiding this comment.
I read all five files under tests/unit/. The suite cleanly targets ros_mcp/utils (response, config_utils, network_utils) with shared fixtures in conftest.py and mocked I/O so nothing requires a live network or robot. Structure and naming look consistent with pytest usage; author’s test plan (pytest tests/unit/, ruff) matches the intent for #308.
raphy0316
left a comment
There was a problem hiding this comment.
Looks great overall — test structure and coverage are really solid
Nice use of mocking and good edge case handling.
Just a couple small thoughts:
- Might be safer to use exact matches instead of substring checks for status
test_with_real_robot_specsfeels a bit like an integration test — maybe worth separating or marking later- Monkeypatching
__file__works, but could be cleaner with injection if we refactor in the future
Otherwise, looks good to me
|
Thanks for putting this together, @Tyrrnien81! Great to see unit test infrastructure being built out, and the test organization is clean. I've been working on the integration test suite (PRs #276-#281, #316, #321) and wanted to share some thoughts on how these two efforts overlap and where to focus energy. What's most valuable hereThe config_utils tests are the highlight — Where there's overlapThe response.py and network_utils.py tests overlap significantly with the integration test suite:
SuggestionWould you consider splitting this into smaller PRs?
This keeps the test suite lean and avoids maintaining mock-heavy tests that duplicate what the integration suite already validates end-to-end. Again, appreciate the effort here — especially the clean pytest structure and proper use of |
stex2005
left a comment
There was a problem hiding this comment.
as per the comment above.
Summary
tests/unit/directory with unit tests forros_mcp/utils/response.py,config_utils.py,network_utils.pyMotivation
Currently, the only tests in
tests/verify package installation (Docker-based). There are no tests for the core utility logic that every tool depends on. This PR adds foundational unit test infrastructure.Changes
tests/unit/__init__.pytests/unit/conftest.pytests/unit/test_response.pytests/unit/test_config_utils.pytests/unit/test_network_utils.pyTest Plan
uv run pytest tests/unit/ -v— all 47 tests passuv run ruff check .— lint passesuv run ruff format --check .— format passesCloses #308