test: try calling gc to fix windows issue

This commit is contained in:
Andrej Milicevic 2025-10-09 17:31:27 +02:00
parent ee96d8f940
commit a44ab88519
2 changed files with 5 additions and 6 deletions

View file

@ -507,7 +507,9 @@ class SQLAlchemyAdapter:
if self.engine.dialect.name == "sqlite":
await self.engine.dispose(close=True)
# Wait for the database connections to close and release the file (Windows)
await asyncio.sleep(2)
import gc
gc.collect()
# await asyncio.sleep(2)
db_directory = path.dirname(self.db_path)
file_name = path.basename(self.db_path)
file_storage = get_file_storage(db_directory)

View file

@ -82,11 +82,6 @@ async def main():
data_root_directory = get_storage_config()["data_root_directory"]
assert not os.path.isdir(data_root_directory), "Local data files are not deleted"
from cognee.infrastructure.databases.relational import get_relational_engine
get_relational_engine().get_session().close()
await get_relational_engine().engine.dispose()
# Assert relational, vector and graph databases have been cleaned properly
await cognee.prune.prune_system(metadata=True)
@ -94,6 +89,8 @@ async def main():
collection_names = await connection.table_names()
assert len(collection_names) == 0, "LanceDB vector database is not empty"
from cognee.infrastructure.databases.relational import get_relational_engine
db_path = get_relational_engine().db_path
dir_path = os.path.dirname(db_path)
file_path = os.path.basename(db_path)