Skip to content

Commit 55215b6

Browse files
authored
chore: cov settings, and fix serveral building warnings (#281)
* chore: cov settings, update Python test dependencies and adjust command arguments * fix: remove .vscode dir
1 parent 8e1490b commit 55215b6

File tree

8 files changed

+40
-10
lines changed

8 files changed

+40
-10
lines changed

crates/rmcp/src/transport/common/client_side_sse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ impl<R: SseStreamReconnect> SseAutoReconnectStream<R> {
134134
}
135135

136136
impl<E: std::error::Error + Send> SseAutoReconnectStream<NeverReconnect<E>> {
137-
pub fn never_reconnect(stream: BoxedSseResponse, error_when_reconnect: E) -> Self {
137+
#[allow(dead_code)]
138+
pub(crate) fn never_reconnect(stream: BoxedSseResponse, error_when_reconnect: E) -> Self {
138139
Self {
139140
retry_policy: Arc::new(NeverRetry),
140141
last_event_id: None,

crates/rmcp/src/transport/common/server_side_http.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(dead_code)]
12
use std::{convert::Infallible, fmt::Display, sync::Arc, time::Duration};
23

34
use bytes::{Buf, Bytes};

crates/rmcp/tests/test_with_python.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async fn init() -> anyhow::Result<()> {
1818
.with(tracing_subscriber::fmt::layer())
1919
.try_init();
2020
tokio::process::Command::new("uv")
21-
.args(["pip", "install", "-r", "pyproject.toml"])
21+
.args(["sync"])
2222
.current_dir("tests/test_with_python")
2323
.spawn()?
2424
.wait()
@@ -38,8 +38,9 @@ async fn test_with_python_client() -> anyhow::Result<()> {
3838

3939
let status = tokio::process::Command::new("uv")
4040
.arg("run")
41-
.arg("tests/test_with_python/client.py")
41+
.arg("client.py")
4242
.arg(format!("http://{BIND_ADDRESS}/sse"))
43+
.current_dir("tests/test_with_python")
4344
.spawn()?
4445
.wait()
4546
.await?;
@@ -88,8 +89,9 @@ async fn test_nested_with_python_client() -> anyhow::Result<()> {
8889
tokio::time::Duration::from_secs(5),
8990
tokio::process::Command::new("uv")
9091
.arg("run")
91-
.arg("tests/test_with_python/client.py")
92+
.arg("client.py")
9293
.arg(format!("http://{BIND_ADDRESS}/nested/sse"))
94+
.current_dir("tests/test_with_python")
9395
.spawn()?
9496
.wait(),
9597
)
@@ -104,7 +106,9 @@ async fn test_with_python_server() -> anyhow::Result<()> {
104106
init().await?;
105107

106108
let transport = TokioChildProcess::new(tokio::process::Command::new("uv").configure(|cmd| {
107-
cmd.arg("run").arg("tests/test_with_python/server.py");
109+
cmd.arg("run")
110+
.arg("server.py")
111+
.current_dir("tests/test_with_python");
108112
}))?;
109113

110114
let client = ().serve(transport).await?;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.lock

crates/rmcp/tests/test_with_python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ name = "test_with_python"
77
version = "0.1.0"
88
description = "Test Python client for RMCP"
99
dependencies = [
10-
"mcp",
10+
"fastmcp",
1111
]
1212

1313
[tool.setuptools]
14-
py-modules = ["client", "server"]
14+
py-modules = ["client", "server"]

crates/rmcp/tests/test_with_python/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from mcp.server.fastmcp import FastMCP
1+
from fastmcp import FastMCP
22

33
mcp = FastMCP("Demo")
44

docs/CONTRIBUTE.MD

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,24 @@ just fix
1010
# How Can I Rewrite My Commit Message?
1111
You can `git reset --soft upstream/main` and `git commit --forge`, this will merge your changes into one commit.
1212

13-
Or you also can use git rebase. But we will still merge them into one commit when it is merged.
13+
Or you also can use git rebase. But we will still merge them into one commit when it is merged.
14+
15+
# Check Code Coverage
16+
If you are developing on vscode, you can use vscode plugin [Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters)
17+
18+
And also need to install llvm-cov
19+
```sh
20+
cargo install cargo-llvm-cov
21+
22+
rustup component add llvm-tools-preview
23+
```
24+
25+
If you are using goverage gutters plugin, add these config to let it know lcov output.
26+
```json
27+
{
28+
"coverage-gutters.coverageFileNames": [
29+
"coverage.lcov",
30+
],
31+
"coverage-gutters.coverageBaseDir": "target/llvm-cov-target",
32+
}
33+
```

justfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ fix: fmt
99
cargo clippy --fix --all-targets --all-features --allow-staged
1010

1111
test:
12-
cargo test --all-features
12+
cargo test --all-features
13+
14+
cov:
15+
cargo llvm-cov --lcov --output-path {{justfile_directory()}}/target/llvm-cov-target/coverage.lcov

0 commit comments

Comments
 (0)