test: add pytest coverage for SSE transport functions#557
Closed
passionateSandy2004 wants to merge 5 commits intomodelcontextprotocol:mainfrom
Closed
test: add pytest coverage for SSE transport functions#557passionateSandy2004 wants to merge 5 commits intomodelcontextprotocol:mainfrom
passionateSandy2004 wants to merge 5 commits intomodelcontextprotocol:mainfrom
Conversation
There was a problem hiding this comment.
Minor suggestions for improvement:
-
Consider using parametrized tests to make the test cases more maintainable
@pytest.mark.parametrize("input_url,expected_output", [ ('http://example.com/test?foo=bar', 'http://example.com/test'), ('http://example.com/test#section', 'http://example.com/test'), ('http://example.com/test', 'http://example.com/test'), ('/test/path?x=1', '/test/path') ]) def test_remove_request_params(input_url, expected_output): assert remove_request_params(input_url) == expected_output
-
Add a brief docstring to the test function to explain its purpose
Contributor
|
Closing this PR, looks stale now. Please re-open if the changes are still needed and suggestions applied. |
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.
Added a new pytest function,
test_remove_request_params, intests/shared/test_sse.pyto cover the previously untestedremove_request_paramsutility in the SSE client module.Motivation and Context
The
remove_request_paramsfunction insrc/mcp/client/sse.pywas not directly tested, leaving potential edge cases unverified. By adding a focused unit test, we ensure that:This aligns the SSE client tests with the project’s coverage standards and closes gaps in our automated test suite.
How Has This Been Tested?
pytest tests/shared/test_sse.pylocally, confirming:http://example.com/path?foo=bar#bazare normalized tohttp://example.com/path.https://mcp.dev/stream) pass through untouched.pytest) to verify no regressions.Breaking Changes
None. This update only adds tests and does not alter library behavior or public APIs.
Types of changes
Checklist
Additional context
This change brings the SSE client’s test coverage to 100% for its public utilities and contributes to overall library reliability.