mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 02:10:38 +02:00
Fix path resolution in install commands (#1951)
This commit is contained in:
parent
7c10feaeb1
commit
3a21e7b9b2
12 changed files with 64 additions and 55 deletions
|
|
@ -66,9 +66,10 @@ class TestEnvironment:
|
|||
env = config.environment
|
||||
assert env.python == "3.12"
|
||||
assert env.dependencies == ["requests", "numpy>=2.0"]
|
||||
assert env.requirements == "requirements.txt"
|
||||
assert env.project == "."
|
||||
assert env.editable == ["../my-package"]
|
||||
# Paths are stored as Path objects
|
||||
assert env.requirements == Path("requirements.txt")
|
||||
assert env.project == Path(".")
|
||||
assert env.editable == [Path("../my-package")]
|
||||
|
||||
def test_needs_uv(self):
|
||||
"""Test needs_uv() method."""
|
||||
|
|
@ -112,12 +113,16 @@ class TestEnvironment:
|
|||
assert "--python" not in cmd
|
||||
assert "3.12" not in cmd
|
||||
assert "--project" in cmd
|
||||
assert "." in cmd
|
||||
# Project path should be resolved to absolute path
|
||||
project_idx = cmd.index("--project")
|
||||
assert Path(cmd[project_idx + 1]).is_absolute()
|
||||
assert "--with" in cmd
|
||||
assert "requests" in cmd
|
||||
assert "numpy" in cmd
|
||||
assert "--with-requirements" in cmd
|
||||
assert "requirements.txt" in cmd
|
||||
# Requirements path should be resolved to absolute path
|
||||
req_idx = cmd.index("--with-requirements")
|
||||
assert Path(cmd[req_idx + 1]).is_absolute()
|
||||
# Command args should be at the end
|
||||
assert "fastmcp" in cmd[-3:]
|
||||
assert "run" in cmd[-2:]
|
||||
|
|
|
|||
|
|
@ -234,10 +234,11 @@ class TestPathResolution:
|
|||
assert config.environment is not None
|
||||
uv_cmd = config.environment.build_command(["fastmcp", "run"])
|
||||
|
||||
# Should include requirements file
|
||||
# Should include requirements file with absolute path
|
||||
assert "--with-requirements" in uv_cmd
|
||||
req_idx = uv_cmd.index("--with-requirements") + 1
|
||||
assert uv_cmd[req_idx] == "requirements.txt"
|
||||
assert Path(uv_cmd[req_idx]).is_absolute()
|
||||
assert Path(uv_cmd[req_idx]).name == "requirements.txt"
|
||||
|
||||
|
||||
class TestConfigValidation:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue