Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/helpers/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,15 @@


def assert_valid_json_rpc_response(response_text: str) -> dict[str, Any]:
"""Assert that response text is valid JSON-RPC and return parsed response."""
"""Assert that response text is valid JSON-RPC and return parsed response.

Fixed static analysis false positive by adding return after pytest.fail().
"""
try:
response = json.loads(response_text)
except json.JSONDecodeError as e:
pytest.fail(f"Response is not valid JSON: {e}\nResponse: {response_text}")
return # Help static analysis understand pytest.fail never returns

Check failure on line 172 in tests/helpers/assertions.py

View workflow job for this annotation

GitHub Actions / Code Issue Annotations

Ruff (RET502)

tests/helpers/assertions.py:172:9: RET502 Do not implicitly `return None` in function able to return non-`None` value

assert "jsonrpc" in response, "Response must have jsonrpc field"
assert response["jsonrpc"] == "2.0", "Response must be JSON-RPC 2.0"
Expand Down
Loading