From 2475f1ba0e8a6ce36daffc660d20239ddefce97b Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sat, 1 Mar 2025 21:19:06 +0100 Subject: [PATCH] Remove DB file instead of truncating it Taskwarrior3 uses a SQLite DB file to store the task data. Truncating the file corrupts the database, letting the tests fail. Removing the DB file resets Taskwarrior as well, and works with 2 and 3. --- test/basetest/task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/basetest/task.py b/test/basetest/task.py index 21ff792..baaab52 100644 --- a/test/basetest/task.py +++ b/test/basetest/task.py @@ -328,8 +328,8 @@ class Task(object): for filename in os.listdir(folder): file_path = os.path.join(folder, filename) try: - print("Emptying {}".format(file_path)) + print("Removing {}".format(file_path)) if os.path.isfile(file_path) or os.path.islink(file_path): - open(file_path, 'w').close() + os.remove(file_path) except Exception as e: print("Failed to delete {}. Reason: {}".format(file_path, e))