File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111@pytest .fixture
1212def temp_dir (monkeypatch ):
1313 """Fixture that creates a temporary TRACKIO_DIR."""
14- with tempfile .TemporaryDirectory () as tmpdir :
14+ with tempfile .TemporaryDirectory (ignore_cleanup_errors = True ) as tmpdir :
1515 for name in ["trackio.sqlite_storage" ]:
1616 monkeypatch .setattr (f"{ name } .TRACKIO_DIR" , Path (tmpdir ))
1717 for name in ["trackio.media" , "trackio.file_storage" ]:
Original file line number Diff line number Diff line change 1+ import gc
12import multiprocessing
23import os
34import platform
@@ -65,13 +66,17 @@ def test_import_export(temp_dir):
6566 SQLiteStorage .log (project = "proj1" , run = "run1" , metrics = {"a" : 1 })
6667 SQLiteStorage .log (project = "proj2" , run = "run2" , metrics = {"b" : 2 })
6768 SQLiteStorage .export_to_parquet ()
69+
6870 metrics_before = {}
6971 for proj in SQLiteStorage .get_projects ():
7072 if proj not in metrics_before :
7173 metrics_before [proj ] = {}
7274 for run in SQLiteStorage .get_runs (proj ):
7375 metrics_before [proj ][run ] = SQLiteStorage .get_logs (proj , run )
7476
77+ ## there might be open connections from previous test, hence closing them
78+ gc .collect ()
79+ [conn .close () for conn in gc .get_objects () if isinstance (conn , sqlite3 .Connection )]
7580 # clear existing SQLite data
7681 os .unlink (db_path_1 )
7782 os .unlink (db_path_2 )
You can’t perform that action at this time.
0 commit comments