Skip to content

Commit c6a9b3d

Browse files
authored
Fix Windows test timeouts from SQLite locking (#2368)
1 parent 5747cb6 commit c6a9b3d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import socket
22
from collections.abc import Callable
3+
from pathlib import Path
34
from typing import Any
45

56
import pytest
67

8+
from fastmcp.utilities.tests import temporary_settings
9+
710

811
def pytest_collection_modifyitems(items):
912
"""Automatically mark tests in integration_tests folder with 'integration' marker."""
@@ -21,6 +24,20 @@ def import_rich_rule():
2124
yield
2225

2326

27+
@pytest.fixture(autouse=True)
28+
def isolate_settings_home(tmp_path: Path):
29+
"""Ensure each test uses an isolated settings.home directory.
30+
31+
This prevents SQLite database locking issues on Windows when multiple
32+
tests share the same DiskStore directory in settings.home / "oauth-proxy".
33+
"""
34+
test_home = tmp_path / "fastmcp-test-home"
35+
test_home.mkdir(exist_ok=True)
36+
37+
with temporary_settings(home=test_home):
38+
yield
39+
40+
2441
def get_fn_name(fn: Callable[..., Any]) -> str:
2542
return fn.__name__ # ty: ignore[unresolved-attribute]
2643

0 commit comments

Comments
 (0)