From a9c07a66ad2813c007d4f0cc84effc9ea648bc21 Mon Sep 17 00:00:00 2001 From: yusyus Date: Sun, 26 Oct 2025 17:19:06 +0300 Subject: [PATCH] Fix GitHub Actions test failures for unified MCP integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed async test issues that were causing CI failures. ## Issue: GitHub Actions tests were failing with: - 4 FAILED tests/test_unified_mcp_integration.py (async def functions not supported) - 346 passed tests ## Root Cause: The new test_unified_mcp_integration.py file had async test functions without proper pytest-anyio configuration, causing pytest to fail when trying to run them. ## Fix: 1. **Added pytest.mark.anyio markers** - Added module-level pytestmark = pytest.mark.anyio - Ensures all async functions are recognized by anyio plugin 2. **Created tests/conftest.py** - Overrides anyio_backend fixture to use only 'asyncio' - Prevents tests from attempting to use 'trio' backend (not installed) - Reduces test duplication (was running each test for both asyncio + trio) 3. **Updated README.md** - Already pushed in previous commit (b4f9052) - Updated descriptions to reflect GitHub scraping capability ## Test Results: **Before Fix:** - 4 failed, 346 passed (in CI) - Error: "async def functions are not natively supported" **After Fix:** - 4 passed tests/test_unified_mcp_integration.py - All tests use asyncio backend only - No trio-related errors ## Files Changed: 1. tests/test_unified_mcp_integration.py - Added pytestmark = pytest.mark.anyio at module level - All 4 async test functions now properly marked 2. tests/conftest.py (NEW) - Created pytest configuration file - Overrides anyio_backend to 'asyncio' only - Prevents unnecessary test duplication ## Verification: Local test run successful: ``` tests/test_unified_mcp_integration.py::test_mcp_validate_unified_config PASSED tests/test_unified_mcp_integration.py::test_mcp_validate_legacy_config PASSED tests/test_unified_mcp_integration.py::test_mcp_scrape_docs_detection PASSED tests/test_unified_mcp_integration.py::test_mcp_merge_mode_override PASSED 4 passed in 0.21s ``` Expected CI result: 350/350 tests passing (up from 346/350) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/conftest.py | 13 +++++++++++++ tests/test_unified_mcp_integration.py | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..5c432a0 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,13 @@ +""" +Pytest configuration for tests. + +Configures anyio to only use asyncio backend (not trio). +""" + +import pytest + + +@pytest.fixture(scope="session") +def anyio_backend(): + """Override anyio backend to only use asyncio (not trio).""" + return "asyncio" diff --git a/tests/test_unified_mcp_integration.py b/tests/test_unified_mcp_integration.py index b9ba879..d8053c8 100644 --- a/tests/test_unified_mcp_integration.py +++ b/tests/test_unified_mcp_integration.py @@ -9,8 +9,12 @@ import sys import json import tempfile import asyncio +import pytest from pathlib import Path +# Configure pytest to only use asyncio backend (not trio) +pytestmark = pytest.mark.anyio + # Add skill_seeker_mcp to path sys.path.insert(0, str(Path(__file__).parent.parent / 'skill_seeker_mcp'))