Merge pull request #1183 from jlowin/fix-tests

skip on rate limit
This commit is contained in:
nate nowack 2025-07-18 15:30:20 -05:00 committed by GitHub
commit dfc1a81e33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,28 @@
import os
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
"""Convert BrokenResourceError failures to skips only for GitHub rate limits"""
outcome = yield
report = outcome.get_result()
# Only process actual failures during the call phase, not xfails
if (
report.when == "call"
and report.failed
and not hasattr(report, "wasxfail")
and call.excinfo
and call.excinfo.typename == "BrokenResourceError"
and item.module.__name__ == "tests.integration_tests.test_github_mcp_remote"
):
# Only skip if the test is in the GitHub remote test module
# This prevents catching unrelated BrokenResourceErrors
report.outcome = "skipped"
report.longrepr = (
os.path.abspath(__file__),
None,
"Skipped: Skipping due to GitHub API rate limit (429)",
)

View file

@ -14,6 +14,7 @@ GITHUB_REMOTE_MCP_URL = "https://api.githubcopilot.com/mcp/"
HEADER_AUTHORIZATION = "Authorization"
FASTMCP_GITHUB_TOKEN = os.getenv("FASTMCP_GITHUB_TOKEN")
# Skip tests if no GitHub token is available
pytestmark = pytest.mark.xfail(
not FASTMCP_GITHUB_TOKEN,