File size: 965 Bytes
5f2c09d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Tests for deprecated dependencies parameter.

This entire file can be deleted when the dependencies parameter is removed (deprecated in v2.11.4).
"""

import warnings

import pytest

from fastmcp import FastMCP


def test_dependencies_parameter_deprecated():
    """Test that using the dependencies parameter raises a deprecation warning."""

    with pytest.warns(DeprecationWarning, match="deprecated as of FastMCP 2.11.4"):
        server = FastMCP("Test Server", dependencies=["pandas", "numpy"])

    # Should still work for backward compatibility
    assert server.dependencies == ["pandas", "numpy"]


def test_no_warning_without_dependencies():
    """Test that no warning is raised when dependencies are not used."""

    with warnings.catch_warnings():
        warnings.simplefilter("error")  # Turn warnings into errors
        server = FastMCP("Test Server")  # Should not raise

    assert server.dependencies == []  # Should use default empty list