From 0b120fac902363670976a036aa72693ba0018aa7 Mon Sep 17 00:00:00 2001 From: alex-clawd Date: Sun, 19 Apr 2026 21:27:12 -0700 Subject: [PATCH] fix: use future dates in checkpoint prune tests to prevent time-dependent failures (#5543) The test_older_than tests in both JSON and SQLite prune suites used hardcoded 2026-04-17 timestamps for the 'new' checkpoint. Once that date passes, the checkpoint is older than 1 day and gets pruned along with the 'old' one, causing assert count >= 1 to fail (count=0). Use 2099-01-01 for the 'new' checkpoint so tests remain stable. Co-authored-by: Joao Moura --- lib/crewai/tests/test_checkpoint_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/crewai/tests/test_checkpoint_cli.py b/lib/crewai/tests/test_checkpoint_cli.py index 38e105cce8..aa1188336f 100644 --- a/lib/crewai/tests/test_checkpoint_cli.py +++ b/lib/crewai/tests/test_checkpoint_cli.py @@ -292,7 +292,7 @@ def test_older_than(self) -> None: d, name="20250101T000000_old01111_p-none.json" ) os.utime(old_path, (0, 0)) - _write_json_checkpoint(d, name="20260417T000000_new01111_p-none.json") + _write_json_checkpoint(d, name="20990101T000000_new01111_p-none.json") deleted = _prune_json(d, keep=None, older_than=timedelta(days=1)) assert deleted == 1 @@ -330,7 +330,7 @@ def test_older_than(self) -> None: with tempfile.TemporaryDirectory() as d: db_path = os.path.join(d, "test.db") _create_sqlite_checkpoint(db_path, "20200101T000000_old01111") - _create_sqlite_checkpoint(db_path, "20260417T000000_new01111") + _create_sqlite_checkpoint(db_path, "20990101T000000_new01111") deleted = _prune_sqlite(db_path, keep=None, older_than=timedelta(days=1)) assert deleted >= 1 with sqlite3.connect(db_path) as conn: