Skip to content

Commit c2792cb

Browse files
committed
update test_mztab_indexer.py
1 parent 4a4fe72 commit c2792cb

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

tests/core/quantms/psms/test_mztab_indexer.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def test_dda_plex_dataset():
7070
pytest.skip("DDA-plex test files not found")
7171

7272
# Create a temporary database path
73-
temp_db_path = tempfile.mktemp(suffix=".duckdb")
73+
temp_fd, temp_db_path = tempfile.mkstemp(suffix=".duckdb")
74+
os.close(temp_fd)
75+
os.unlink(temp_db_path)
7476

7577
indexer = None
7678
try:
@@ -206,7 +208,9 @@ def test_dda_lfq_dataset():
206208
pytest.skip("DDA-LFQ test files not found")
207209

208210
# Create a temporary database path
209-
temp_db_path = tempfile.mktemp(suffix=".duckdb")
211+
temp_fd, temp_db_path = tempfile.mkstemp(suffix=".duckdb")
212+
os.close(temp_fd)
213+
os.unlink(temp_db_path)
210214

211215
indexer = None
212216
try:
@@ -341,7 +345,9 @@ def test_add_msstats_to_existing_db():
341345
pytest.skip("DDA-LFQ test files not found")
342346

343347
# Create a temporary database path
344-
temp_db_path = tempfile.mktemp(suffix=".duckdb")
348+
temp_fd, temp_db_path = tempfile.mkstemp(suffix=".duckdb")
349+
os.close(temp_fd)
350+
os.unlink(temp_db_path)
345351

346352
indexer1 = None
347353
indexer2 = None
@@ -415,7 +421,9 @@ def test_mztab_metadata_parsing():
415421
pytest.skip("DDA-plex test files not found")
416422

417423
# Create a temporary database path
418-
temp_db_path = tempfile.mktemp(suffix=".duckdb")
424+
temp_fd, temp_db_path = tempfile.mkstemp(suffix=".duckdb")
425+
os.close(temp_fd) # Close file descriptor, let DuckDB create the file
426+
os.unlink(temp_db_path) # Remove the empty file
419427

420428
indexer = None
421429
try:
@@ -456,7 +464,9 @@ def test_mztab_stream_section():
456464
pytest.skip("DDA-plex test files not found")
457465

458466
# Create a temporary database path
459-
temp_db_path = tempfile.mktemp(suffix=".duckdb")
467+
temp_fd, temp_db_path = tempfile.mkstemp(suffix=".duckdb")
468+
os.close(temp_fd)
469+
os.unlink(temp_db_path)
460470

461471
indexer = None
462472
try:

0 commit comments

Comments
 (0)