Pyright passing

This commit is contained in:
Jeremiah Lowin 2024-12-03 13:55:13 -05:00
commit 2b3e3ec360
3 changed files with 8 additions and 6 deletions

View file

@ -42,7 +42,7 @@ asyncio_default_fixture_loop_scope = "session"
source = "vcs"
[tool.pyright]
include = ["src"]
include = ["src", "tests"]
exclude = ["**/node_modules", "**/__pycache__", ".venv", ".git", "dist"]
pythonVersion = "3.10"
pythonPlatform = "Darwin"

View file

@ -25,7 +25,7 @@ def mcp() -> FastMCP:
@pytest.fixture(autouse=True)
def resources(mcp: FastMCP, test_dir: Path) -> None:
def resources(mcp: FastMCP, test_dir: Path) -> FastMCP:
@mcp.resource("dir://test_dir")
def list_test_dir() -> list[str]:
"""List the files in the test directory"""
@ -59,7 +59,7 @@ def resources(mcp: FastMCP, test_dir: Path) -> None:
@pytest.fixture(autouse=True)
def tools(mcp: FastMCP, test_dir: Path) -> None:
def tools(mcp: FastMCP, test_dir: Path) -> FastMCP:
@mcp.tool()
def delete_file(path: str) -> bool:
# ensure path is in test_dir
@ -68,6 +68,8 @@ def tools(mcp: FastMCP, test_dir: Path) -> None:
Path(path).unlink()
return True
return mcp
async def test_list_resources(mcp: FastMCP):
resources = await mcp.list_resources()

View file

@ -192,9 +192,9 @@ def test_skip_names():
assert "also_skip" not in meta.arg_model.model_fields
# Validate that we can call with only non-skipped parameters
model = meta.arg_model.model_validate({"keep_this": 1, "also_keep": 2.5})
assert model.keep_this == 1
assert model.also_keep == 2.5
model: BaseModel = meta.arg_model.model_validate({"keep_this": 1, "also_keep": 2.5}) # type: ignore
assert model.keep_this == 1 # type: ignore
assert model.also_keep == 2.5 # type: ignore
async def test_lambda_function():