From 78a5599bdb47dc0e3d7e1520459a1d9d07dce94c Mon Sep 17 00:00:00 2001 From: Cryp Toon Date: Mon, 5 Feb 2024 13:42:27 +0100 Subject: [PATCH] Fix PermissionErrors in Windows wallet unittest --- tests/test_wallets.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_wallets.py b/tests/test_wallets.py index 927f44b6..4f1342db 100644 --- a/tests/test_wallets.py +++ b/tests/test_wallets.py @@ -184,7 +184,13 @@ def database_init(dbname=DATABASE_NAME): else: dburi = os.path.join(str(BCL_DATABASE_DIR), '%s.sqlite' % dbname) if os.path.isfile(dburi): - os.remove(dburi) + try: + os.remove(dburi) + except PermissionError: + db_obj = Db(dburi) + db_obj.drop_db(True) + db_obj.session.close() + db_obj.engine.dispose() return dburi