test: expand coverage to server.py and __main__.py (#72)#87
Open
TumCucTom wants to merge 1 commit into
Open
Conversation
The existing tests/ directory only covered utils.py. server.py (~746 lines, all the @mcp.tool() functions) and __main__.py (~100 lines, the CLI entry) were at 0% coverage, meaning any regression in the public MCP tool surface or the CLI launch path would go unnoticed. Add: - tests/test_server.py with mocked-end-to-end tests for the major tool functions (text_to_audio, text_to_image, music_generation, play_audio, generate_video, voice_clone) plus input-validation and filesystem-path-construction tests. - tests/test_main.py with import-time and entry-point smoke tests for __main__.py. All tests use unittest.mock to avoid network/audio calls. Coverage of server.py climbs from 0% to 92%, __main__.py from 0% to 100%. No production code changed; test files only. Fixes MiniMax-AI#72. Co-authored-by: Zippy AI <tomkinsbale@icloud.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
tests/test_server.pywith mocked-end-to-end tests for the major@mcp.tool()functions:text_to_audio,text_to_image,music_generation,play_audio,generate_video,voice_clone. Covers input-validation fast-fail paths, filesystem-path construction, and the success path with a mockedapi_client.tests/test_main.pywith import-time and entry-point smoke tests for__main__.py.unittest.mockto avoid real API / audio calls.Why
Issue #72: the test suite only covered
utils.py.server.py(~746 lines, the entire MCP tool surface) and__main__.pywere at 0% coverage, so any regression in those files would go unnoticed.Coverage
Before:
server.py0% (287/287 stmts missed),__main__.py0% (51/51 stmts missed).After:
server.py92% (22 stmts missed),__main__.py100%. Total project coverage 88%.The 22 missed lines in
server.pyare mostly defensive exception handlers forIOError/RequestExceptionpaths that don't naturally fire when theapi_clientis mocked.Test plan
pytest tests/ -v— all 74 tests passpytest --cov=minimax_mcp --cov-report=term-missing— shows the coverage improvementtext_to_audio"Text is required" check makes 2 tests fail withDID NOT RAISE, confirming the tests are not vacuous. Same formusic_generation's prompt/lyrics checks.Fixes #72.
Generated with Claude Code