Fix pytest warning about empty match parameter in pytest.raises #162
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
Fixes pytest warnings that occur when using
pytest.raises(..., match="")with an empty string pattern. The warnings were introduced in newer versions of pytest and appear in several test cases.Problem
The test suite was generating warnings like:
This occurred in the
_assert_is_disconnectedhelper function which was usingmatch=r""when testingClientNotConnectedexceptions.Solution
match=r""parameter frompytest.raises(ClientNotConnected)calls since the tests only need to verify the exception type and attributes, not the message contentserver_urlandoperation) as beforeTesting
All previously failing tests now pass without warnings:
test_base_api_client_init[auto_connect=False]test_base_api_client_disconnecttest_base_api_client_async_context_manager[auto_connect=True]test_base_api_client_async_context_manager[auto_connect=False]The fix is minimal and surgical - it only removes the problematic empty match pattern while maintaining all existing test functionality.