[BugFix] obb.famafrench.breakpoints - Fix Bad Widget Param Options (#7168)

* fix bad widget options

* fix mcp tests?

* rename test file

* might have needed that .gitkeep

* ignore mcp_server tests in noxfile for 3.9
This commit is contained in:
Danglewood
2025-07-15 08:37:20 -07:00
committed by GitHub
parent 1eda464386
commit 3e72019476
9 changed files with 50 additions and 21 deletions

View File

@@ -26,8 +26,19 @@ def unit_test_platform(session):
)
session.install("pytest")
session.install("pytest-cov")
# Determine if we should ignore mcp_server tests based on Python version
ignore_args = []
if session.python == "3.9":
ignore_args = ["--ignore=" + str(PLATFORM_DIR / "extensions/mcp_server/tests")]
session.run(
"pytest", *PLATFORM_TESTS, f"--cov={PLATFORM_DIR}", "-m", "not integration"
"pytest",
*PLATFORM_TESTS,
*ignore_args,
f"--cov={PLATFORM_DIR}",
"-m",
"not integration",
)

View File

@@ -1,9 +0,0 @@
"""Tests for the MCP server extension."""
import sys
import pytest
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)

View File

@@ -1,6 +1,7 @@
"""Unit tests for config utilities."""
import json
import sys
from pathlib import Path
from unittest.mock import mock_open, patch
@@ -15,6 +16,10 @@ from openbb_mcp_server.utils.config import (
)
from openbb_mcp_server.utils.settings import MCPSettings
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
def test_get_mcp_config_path():
path = get_mcp_config_path()

View File

@@ -1,11 +1,17 @@
"""Unit tests for main module."""
import sys
from unittest.mock import ANY, MagicMock, patch
import pytest
from fastapi import FastAPI
from openbb_mcp_server.main import _extract_brief_description, create_mcp_server, main
from openbb_mcp_server.utils.settings import MCPSettings
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
def test_extract_brief_description():
full_desc = """Brief description.

View File

@@ -1,9 +1,16 @@
"""Unit tests for route filtering utilities."""
import sys
import pytest
from fastmcp.server.openapi import MCPType
from openbb_mcp_server.utils.route_filtering import create_route_maps_from_settings
from openbb_mcp_server.utils.settings import MCPSettings
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
def test_create_route_maps_from_settings_no_allowed():
settings = MCPSettings(allowed_tool_categories=None)

View File

@@ -1,9 +1,16 @@
"""Test schema compression in fastmcp."""
import json
import sys
import pytest
from openbb_core.api.rest_api import app as fastapi_app
from openbb_mcp_server.main import MCPSettings, create_mcp_server
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
@pytest.mark.integration
@pytest.mark.asyncio

View File

@@ -1,7 +1,14 @@
"""Unit tests for MCPSettings model."""
import sys
import pytest
from openbb_mcp_server.utils.settings import MCPSettings
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
def test_mcp_settings_defaults():
settings = MCPSettings()

View File

@@ -1,7 +1,7 @@
"""Unit tests for ToolRegistry."""
# pylint: disable=redefined-outer-name
import sys
from unittest.mock import MagicMock
import pytest
@@ -9,6 +9,10 @@ from fastmcp.server.openapi import OpenAPITool
from openbb_mcp_server.registry import ToolRegistry
from openbb_mcp_server.tool_models import ToggleResult
# Skip all tests if Python version < 3.10
if sys.version_info < (3, 10):
pytest.skip("MCP server requires Python 3.10+", allow_module_level=True)
@pytest.fixture
def tool_registry():

View File

@@ -12,21 +12,12 @@ from openbb_core.provider.abstract.fetcher import Fetcher
from openbb_core.provider.abstract.query_params import QueryParams
from pydantic import Field
from openbb_famafrench.utils.constants import (
BREAKPOINT_CHOICES,
BreakpointChoices,
)
from openbb_famafrench.utils.constants import BreakpointChoices
class FamaFrenchBreakpointQueryParams(QueryParams):
"""Fama-French Breakpoints Query."""
__json_schema_extra__ = {
"breakpoint_type": {
"choices": BREAKPOINT_CHOICES,
}
}
breakpoint_type: BreakpointChoices = Field(
default="me",
description="""Type of breakpoint to fetch.