Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
3dafe0d
1
Parent(s): 208e515
Pyright passing
Browse files- pyproject.toml +1 -1
- tests/servers/test_file_server.py +4 -2
- tests/test_func_metadata.py +3 -3
pyproject.toml
CHANGED
|
@@ -42,7 +42,7 @@ asyncio_default_fixture_loop_scope = "session"
|
|
| 42 |
source = "vcs"
|
| 43 |
|
| 44 |
[tool.pyright]
|
| 45 |
-
include = ["src"]
|
| 46 |
exclude = ["**/node_modules", "**/__pycache__", ".venv", ".git", "dist"]
|
| 47 |
pythonVersion = "3.10"
|
| 48 |
pythonPlatform = "Darwin"
|
|
|
|
| 42 |
source = "vcs"
|
| 43 |
|
| 44 |
[tool.pyright]
|
| 45 |
+
include = ["src", "tests"]
|
| 46 |
exclude = ["**/node_modules", "**/__pycache__", ".venv", ".git", "dist"]
|
| 47 |
pythonVersion = "3.10"
|
| 48 |
pythonPlatform = "Darwin"
|
tests/servers/test_file_server.py
CHANGED
|
@@ -25,7 +25,7 @@ def mcp() -> FastMCP:
|
|
| 25 |
|
| 26 |
|
| 27 |
@pytest.fixture(autouse=True)
|
| 28 |
-
def resources(mcp: FastMCP, test_dir: Path) ->
|
| 29 |
@mcp.resource("dir://test_dir")
|
| 30 |
def list_test_dir() -> list[str]:
|
| 31 |
"""List the files in the test directory"""
|
|
@@ -59,7 +59,7 @@ def resources(mcp: FastMCP, test_dir: Path) -> None:
|
|
| 59 |
|
| 60 |
|
| 61 |
@pytest.fixture(autouse=True)
|
| 62 |
-
def tools(mcp: FastMCP, test_dir: Path) ->
|
| 63 |
@mcp.tool()
|
| 64 |
def delete_file(path: str) -> bool:
|
| 65 |
# ensure path is in test_dir
|
|
@@ -68,6 +68,8 @@ def tools(mcp: FastMCP, test_dir: Path) -> None:
|
|
| 68 |
Path(path).unlink()
|
| 69 |
return True
|
| 70 |
|
|
|
|
|
|
|
| 71 |
|
| 72 |
async def test_list_resources(mcp: FastMCP):
|
| 73 |
resources = await mcp.list_resources()
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
@pytest.fixture(autouse=True)
|
| 28 |
+
def resources(mcp: FastMCP, test_dir: Path) -> FastMCP:
|
| 29 |
@mcp.resource("dir://test_dir")
|
| 30 |
def list_test_dir() -> list[str]:
|
| 31 |
"""List the files in the test directory"""
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
@pytest.fixture(autouse=True)
|
| 62 |
+
def tools(mcp: FastMCP, test_dir: Path) -> FastMCP:
|
| 63 |
@mcp.tool()
|
| 64 |
def delete_file(path: str) -> bool:
|
| 65 |
# ensure path is in test_dir
|
|
|
|
| 68 |
Path(path).unlink()
|
| 69 |
return True
|
| 70 |
|
| 71 |
+
return mcp
|
| 72 |
+
|
| 73 |
|
| 74 |
async def test_list_resources(mcp: FastMCP):
|
| 75 |
resources = await mcp.list_resources()
|
tests/test_func_metadata.py
CHANGED
|
@@ -192,9 +192,9 @@ def test_skip_names():
|
|
| 192 |
assert "also_skip" not in meta.arg_model.model_fields
|
| 193 |
|
| 194 |
# Validate that we can call with only non-skipped parameters
|
| 195 |
-
model = meta.arg_model.model_validate({"keep_this": 1, "also_keep": 2.5})
|
| 196 |
-
assert model.keep_this == 1
|
| 197 |
-
assert model.also_keep == 2.5
|
| 198 |
|
| 199 |
|
| 200 |
async def test_lambda_function():
|
|
|
|
| 192 |
assert "also_skip" not in meta.arg_model.model_fields
|
| 193 |
|
| 194 |
# Validate that we can call with only non-skipped parameters
|
| 195 |
+
model: BaseModel = meta.arg_model.model_validate({"keep_this": 1, "also_keep": 2.5}) # type: ignore
|
| 196 |
+
assert model.keep_this == 1 # type: ignore
|
| 197 |
+
assert model.also_keep == 2.5 # type: ignore
|
| 198 |
|
| 199 |
|
| 200 |
async def test_lambda_function():
|