Skip to content

Commit d3e95e6

Browse files
committed
skipping add and echo which work only with the minimal reference server
1 parent 08d9cf9 commit d3e95e6

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

mcp_testing/scripts/compliance_report.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,22 @@ async def run_tests(self, tests, protocol, server_command, env_vars, timeout=Non
160160

161161
total_time = time.time() - self.start_time
162162

163-
# Count passed and failed tests, handling non-dictionary results
163+
# Count passed, failed, and skipped tests, handling non-dictionary results
164164
passed = 0
165165
skipped = 0
166166
for r in test_results:
167167
if isinstance(r, dict):
168168
if r.get("passed", False):
169-
passed += 1
169+
if "skipped" in r.get("message", "").lower():
170+
skipped += 1
171+
else:
172+
passed += 1
170173
if r.get("skipped", False):
171174
skipped += 1
172175

173-
failed = total_tests - passed
176+
failed = total_tests - passed - skipped
174177

175-
log_with_timestamp(f"Test suite completed: {passed} passed, {failed} failed, total time: {total_time:.2f}s")
178+
log_with_timestamp(f"Test suite completed: {passed} passed, {failed} failed, {skipped} skipped, total time: {total_time:.2f}s")
176179

177180
# Format the results exactly like the standard runner does
178181
return {
@@ -428,7 +431,12 @@ async def main():
428431
}
429432

430433
# Calculate compliance percentage
431-
compliance_percentage = (passed_tests / total_tests) * 100 if total_tests > 0 else 0
434+
if isinstance(results, dict) and 'skipped' in results:
435+
# Exclude skipped tests from the total when calculating compliance
436+
adjusted_total = total_tests - results['skipped']
437+
compliance_percentage = (passed_tests / adjusted_total) * 100 if adjusted_total > 0 else 100
438+
else:
439+
compliance_percentage = (passed_tests / total_tests) * 100 if total_tests > 0 else 0
432440

433441
# Determine compliance status
434442
if compliance_percentage == 100:
@@ -442,6 +450,8 @@ async def main():
442450
log_with_timestamp(f"Total tests: {total_tests}")
443451
log_with_timestamp(f"Passed: {passed_tests}")
444452
log_with_timestamp(f"Failed: {failed_tests}")
453+
if isinstance(results, dict) and 'skipped' in results:
454+
log_with_timestamp(f"Skipped: {results['skipped']}")
445455
log_with_timestamp(f"Compliance Status: {compliance_status} ({compliance_percentage:.1f}%)")
446456

447457
# Extract server name from the command (for report purposes)

mcp_testing/tests/features/test_tools.py

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ async def test_echo_tool(protocol: MCPProtocolAdapter) -> Tuple[bool, str]:
6060
# Check if echo tool is available
6161
echo_tools = [t for t in tools if t.get("name") == "echo"]
6262
if not echo_tools:
63+
# Mark this test as skipped rather than passed or failed
6364
return True, "Echo tool not available (skipping test)"
6465

6566
# Call the echo tool
@@ -99,6 +100,7 @@ async def test_add_tool(protocol: MCPProtocolAdapter) -> Tuple[bool, str]:
99100
# Check if add tool is available
100101
add_tools = [t for t in tools if t.get("name") == "add"]
101102
if not add_tools:
103+
# Mark this test as skipped rather than passed or failed
102104
return True, "Add tool not available (skipping test)"
103105

104106
# Call the add tool
@@ -163,6 +165,7 @@ async def test_tool_with_invalid_params(protocol: MCPProtocolAdapter) -> Tuple[b
163165
# Try add tool as fallback
164166
add_tools = [t for t in tools if t.get("name") == "add"]
165167
if not add_tools:
168+
# No suitable tools for this test, mark as skipped
166169
return True, "No suitable tools available for this test (skipping)"
167170

168171
# Call add tool with wrong parameter names

0 commit comments

Comments
 (0)