33import pytest
44
55
6- def _is_rate_limit_error (excinfo ) -> bool :
7- """Check if an exception indicates a rate limit error from GitHub API."""
6+ def _is_rate_limit_error (excinfo , report = None ) -> bool :
7+ """Check if an exception indicates a rate limit error from GitHub API.
8+
9+ Args:
10+ excinfo: The exception info from pytest
11+ report: Optional test report for additional context (captured output, longrepr)
12+ """
813 if excinfo is None :
914 return False
1015
@@ -28,6 +33,20 @@ def _is_rate_limit_error(excinfo) -> bool:
2833 if "429" in exc_str or "rate limit" in exc_str or "too many requests" in exc_str :
2934 return True
3035
36+ # Timeout exceptions may indicate rate limiting when the 429 causes asyncio
37+ # shutdown issues. Check if it's a timeout and look for 429 in the captured output.
38+ if "timeout" in exc_type .lower () or "timeout" in exc_str :
39+ # Check captured output for 429 indicators
40+ if report is not None :
41+ longrepr_str = str (report .longrepr ).lower () if report .longrepr else ""
42+ if "429" in longrepr_str or "too many requests" in longrepr_str :
43+ return True
44+
45+ # Check captured stdout/stderr
46+ for section_name , content in getattr (report , "sections" , []):
47+ if "429" in content or "too many requests" in content .lower ():
48+ return True
49+
3150 return False
3251
3352
@@ -43,7 +62,7 @@ def pytest_runtest_makereport(item, call):
4362 and report .failed
4463 and not hasattr (report , "wasxfail" )
4564 and item .module .__name__ == "tests.integration_tests.test_github_mcp_remote"
46- and _is_rate_limit_error (call .excinfo )
65+ and _is_rate_limit_error (call .excinfo , report )
4766 ):
4867 report .outcome = "skipped"
4968 report .longrepr = (
0 commit comments