Jeremiah Lowin commited on
Commit
4d9630f
·
1 Parent(s): 4dee55e

Raise errors when deprecated routes are used

Browse files
pyproject.toml CHANGED
@@ -86,7 +86,7 @@ fallback-version = "0.0.0"
86
  asyncio_mode = "auto"
87
  asyncio_default_fixture_loop_scope = "session"
88
  asyncio_default_test_loop_scope = "session"
89
- filterwarnings = []
90
  timeout = 3
91
  env = [
92
  "FASTMCP_TEST_MODE=1",
 
86
  asyncio_mode = "auto"
87
  asyncio_default_fixture_loop_scope = "session"
88
  asyncio_default_test_loop_scope = "session"
89
+ filterwarnings = ["error::DeprecationWarning"]
90
  timeout = 3
91
  env = [
92
  "FASTMCP_TEST_MODE=1",
tests/deprecated/__init__.py CHANGED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import pytest
2
+
3
+ # reset deprecation warnings for this module
4
+ pytestmark = pytest.mark.filterwarnings("default::DeprecationWarning")
tests/deprecated/test_deprecated.py CHANGED
@@ -1,5 +1,3 @@
1
- """Tests for deprecated functionality."""
2
-
3
  import warnings
4
  from unittest.mock import AsyncMock, patch
5
 
@@ -8,6 +6,9 @@ from starlette.applications import Starlette
8
 
9
  from fastmcp import Client, FastMCP
10
 
 
 
 
11
 
12
  def test_sse_app_deprecation_warning():
13
  """Test that sse_app raises a deprecation warning."""
 
 
 
1
  import warnings
2
  from unittest.mock import AsyncMock, patch
3
 
 
6
 
7
  from fastmcp import Client, FastMCP
8
 
9
+ # reset deprecation warnings for this module
10
+ pytestmark = pytest.mark.filterwarnings("default::DeprecationWarning")
11
+
12
 
13
  def test_sse_app_deprecation_warning():
14
  """Test that sse_app raises a deprecation warning."""
tests/deprecated/test_mount_separators.py CHANGED
@@ -4,6 +4,9 @@ import pytest
4
 
5
  from fastmcp import FastMCP
6
 
 
 
 
7
 
8
  def test_mount_tool_separator_deprecation_warning():
9
  """Test that using tool_separator in mount() raises a deprecation warning."""
 
4
 
5
  from fastmcp import FastMCP
6
 
7
+ # reset deprecation warnings for this module
8
+ pytestmark = pytest.mark.filterwarnings("default::DeprecationWarning")
9
+
10
 
11
  def test_mount_tool_separator_deprecation_warning():
12
  """Test that using tool_separator in mount() raises a deprecation warning."""
tests/deprecated/test_resource_prefixes.py CHANGED
@@ -1,5 +1,7 @@
1
  """Tests for legacy resource prefix behavior."""
2
 
 
 
3
  from fastmcp import Client, FastMCP
4
  from fastmcp.server.server import (
5
  add_resource_prefix,
@@ -8,6 +10,9 @@ from fastmcp.server.server import (
8
  )
9
  from fastmcp.utilities.tests import temporary_settings
10
 
 
 
 
11
 
12
  class TestLegacyResourcePrefixes:
13
  """Test the legacy resource prefix behavior."""
 
1
  """Tests for legacy resource prefix behavior."""
2
 
3
+ import pytest
4
+
5
  from fastmcp import Client, FastMCP
6
  from fastmcp.server.server import (
7
  add_resource_prefix,
 
10
  )
11
  from fastmcp.utilities.tests import temporary_settings
12
 
13
+ # reset deprecation warnings for this module
14
+ pytestmark = pytest.mark.filterwarnings("default::DeprecationWarning")
15
+
16
 
17
  class TestLegacyResourcePrefixes:
18
  """Test the legacy resource prefix behavior."""
tests/deprecated/test_route_type_ignore.py CHANGED
@@ -12,6 +12,9 @@ from fastmcp.server.openapi import (
12
  RouteType,
13
  )
14
 
 
 
 
15
 
16
  def test_route_type_ignore_deprecation_warning():
17
  """Test that using RouteType.IGNORE emits a deprecation warning."""
 
12
  RouteType,
13
  )
14
 
15
+ # reset deprecation warnings for this module
16
+ pytestmark = pytest.mark.filterwarnings("default::DeprecationWarning")
17
+
18
 
19
  def test_route_type_ignore_deprecation_warning():
20
  """Test that using RouteType.IGNORE emits a deprecation warning."""