Skip to content

Commit 4230e98

Browse files
committed
Fix Windows CI: Add global mock for os.getloadavg
- Add conftest.py with autouse fixture to mock os.getloadavg on Windows - Ensures all tests work on platforms without getloadavg function - Mock only applies when getloadavg is not available (Windows) - All existing tests continue to pass
1 parent ae7fd2a commit 4230e98

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/conftest.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Test configuration and fixtures."""
2+
3+
import os
4+
import sys
5+
from unittest.mock import patch
6+
7+
import pytest
8+
9+
10+
@pytest.fixture(autouse=True)
11+
def mock_windows_specific_functions():
12+
"""Mock Windows-incompatible functions for all tests."""
13+
# Only apply this mock on Windows or if getloadavg doesn't exist
14+
if not hasattr(os, 'getloadavg'):
15+
with patch('system_info_mcp.tools.os.getloadavg', return_value=(0.1, 0.1, 0.1)):
16+
yield
17+
else:
18+
yield

0 commit comments

Comments
 (0)