Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def temp_dir() -> Iterator[str]:
@pytest.fixture
def temp_db_path() -> Iterator[str]:
"""Create a temporary SQLite database file for testing."""
fd, path = tempfile.mkstemp(suffix=".sqlite")
os.close(fd)
temp_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
path = temp_file.name
temp_file.close()
yield path
if os.path.exists(path):
os.remove(path)
Expand Down
10 changes: 6 additions & 4 deletions test/test_conversation_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ async def test_multiple_conversations_different_dbs(
related_terms_settings = RelatedTermIndexSettings(embedding_settings)

# Create temporary database files
fd1, db_path1 = tempfile.mkstemp(suffix=".sqlite")
fd2, db_path2 = tempfile.mkstemp(suffix=".sqlite")
os.close(fd1)
os.close(fd2)
temp_file1 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
db_path1 = temp_file1.name
temp_file1.close()
temp_file2 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
db_path2 = temp_file2.name
temp_file2.close()

try:
# Create first provider with conversation "conv1"
Expand Down
4 changes: 3 additions & 1 deletion test/test_message_text_index_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
async def test_message_text_index_population_from_database():
"""Test that message text index is correctly populated when reopening a database."""
load_dotenv()
temp_db_path = tempfile.mktemp(suffix=".sqlite")
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_db_path = temp_db_file.name
temp_db_file.close()

try:
# Use the test model that's already configured in the system
Expand Down
4 changes: 3 additions & 1 deletion test/test_property_index_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ async def get_embeddings(self, keys: list[str]) -> np.ndarray:
async def test_property_index_population_from_database(really_needs_auth):
"""Test that property index is correctly populated when reopening a database."""
load_dotenv()
temp_db_path = tempfile.mktemp(suffix=".sqlite")
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_db_path = temp_db_file.name
temp_db_file.close()

try:
embedding_model = MockEmbeddingModel()
Expand Down
4 changes: 3 additions & 1 deletion test/test_related_terms_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
@pytest.mark.asyncio
async def test_related_terms_index_minimal():
"""Fast test with minimal data to verify related terms functionality."""
temp_db_path = tempfile.mktemp(suffix=".sqlite")
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_db_path = temp_db_file.name
temp_db_file.close()

try:
# Create minimal test data with test embedding model (no API keys needed)
Expand Down
4 changes: 3 additions & 1 deletion test/test_related_terms_index_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
async def test_related_terms_index_population_from_database(really_needs_auth):
"""Test that related terms index is correctly populated when reopening a database."""
load_dotenv()
temp_db_path = tempfile.mktemp(suffix=".sqlite")
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_db_path = temp_db_file.name
temp_db_file.close()

try:
# Use the test model that's already configured in the system
Expand Down
10 changes: 6 additions & 4 deletions test/test_storage_providers_unified.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,12 @@ async def test_storage_provider_independence(
import tempfile
import os

fd1, temp_path1 = tempfile.mkstemp(suffix=".sqlite")
os.close(fd1)
fd2, temp_path2 = tempfile.mkstemp(suffix=".sqlite")
os.close(fd2)
temp_file1 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_path1 = temp_file1.name
temp_file1.close()
temp_file2 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
temp_path2 = temp_file2.name
temp_file2.close()

sqlite_provider1 = None
sqlite_provider2 = None
Expand Down