Skip to content

Commit 723dc5a

Browse files
committed
Merge branch 'main' into umeshma/dev
2 parents 8a6a0c4 + a030597 commit 723dc5a

7 files changed

+27
-14
lines changed

test/fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def temp_dir() -> Iterator[str]:
6868
@pytest.fixture
6969
def temp_db_path() -> Iterator[str]:
7070
"""Create a temporary SQLite database file for testing."""
71-
fd, path = tempfile.mkstemp(suffix=".sqlite")
72-
os.close(fd)
71+
temp_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
72+
path = temp_file.name
73+
temp_file.close()
7374
yield path
7475
if os.path.exists(path):
7576
os.remove(path)

test/test_conversation_metadata.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,12 @@ async def test_multiple_conversations_different_dbs(
250250
related_terms_settings = RelatedTermIndexSettings(embedding_settings)
251251

252252
# Create temporary database files
253-
fd1, db_path1 = tempfile.mkstemp(suffix=".sqlite")
254-
fd2, db_path2 = tempfile.mkstemp(suffix=".sqlite")
255-
os.close(fd1)
256-
os.close(fd2)
253+
temp_file1 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
254+
db_path1 = temp_file1.name
255+
temp_file1.close()
256+
temp_file2 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
257+
db_path2 = temp_file2.name
258+
temp_file2.close()
257259

258260
try:
259261
# Create first provider with conversation "conv1"

test/test_message_text_index_population.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
async def test_message_text_index_population_from_database():
2424
"""Test that message text index is correctly populated when reopening a database."""
2525
load_dotenv()
26-
temp_db_path = tempfile.mktemp(suffix=".sqlite")
26+
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
27+
temp_db_path = temp_db_file.name
28+
temp_db_file.close()
2729

2830
try:
2931
# Use the test model that's already configured in the system

test/test_property_index_population.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ async def get_embeddings(self, keys: list[str]) -> np.ndarray:
3838
async def test_property_index_population_from_database(really_needs_auth):
3939
"""Test that property index is correctly populated when reopening a database."""
4040
load_dotenv()
41-
temp_db_path = tempfile.mktemp(suffix=".sqlite")
41+
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
42+
temp_db_path = temp_db_file.name
43+
temp_db_file.close()
4244

4345
try:
4446
embedding_model = MockEmbeddingModel()

test/test_related_terms_fast.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
@pytest.mark.asyncio
2020
async def test_related_terms_index_minimal():
2121
"""Fast test with minimal data to verify related terms functionality."""
22-
temp_db_path = tempfile.mktemp(suffix=".sqlite")
22+
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
23+
temp_db_path = temp_db_file.name
24+
temp_db_file.close()
2325

2426
try:
2527
# Create minimal test data with test embedding model (no API keys needed)

test/test_related_terms_index_population.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
async def test_related_terms_index_population_from_database(really_needs_auth):
2828
"""Test that related terms index is correctly populated when reopening a database."""
2929
load_dotenv()
30-
temp_db_path = tempfile.mktemp(suffix=".sqlite")
30+
temp_db_file = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
31+
temp_db_path = temp_db_file.name
32+
temp_db_file.close()
3133

3234
try:
3335
# Use the test model that's already configured in the system

test/test_storage_providers_unified.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,12 @@ async def test_storage_provider_independence(
590590
import tempfile
591591
import os
592592

593-
fd1, temp_path1 = tempfile.mkstemp(suffix=".sqlite")
594-
os.close(fd1)
595-
fd2, temp_path2 = tempfile.mkstemp(suffix=".sqlite")
596-
os.close(fd2)
593+
temp_file1 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
594+
temp_path1 = temp_file1.name
595+
temp_file1.close()
596+
temp_file2 = tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False)
597+
temp_path2 = temp_file2.name
598+
temp_file2.close()
597599

598600
sqlite_provider1 = None
599601
sqlite_provider2 = None

0 commit comments

Comments
 (0)