Skip to content

Commit

Permalink
better testing
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Feb 5, 2025
1 parent c5a0b7e commit 3ead8c0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_60_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def test_expire_cache_entries_batch(

tic = time.perf_counter()
count = clean.expire_cache_entries(
before=datetime.datetime.now(),
before=TOMORROW,
batch_size=batch_size,
batch_delay=batch_delay,
delete=delete,
Expand Down Expand Up @@ -505,3 +505,16 @@ def test_expire_clean_cache_files_batch(

fs, dirname = utils.get_cache_files_fs_dirname()
assert fs.ls(dirname) == []


@pytest.mark.parametrize("dry_run,cache_entries", [(True, 1), (False, 0)])
def test_expire_cache_entries_dry_run(dry_run: bool, cache_entries: int) -> None:
con = config.get().engine.raw_connection()
cur = con.cursor()

cached_now()
count = clean.expire_cache_entries(dry_run=dry_run, delete=True, before=TOMORROW)
assert count == 1

cur.execute("SELECT COUNT(*) FROM cache_entries", ())
assert cur.fetchone() == (cache_entries,)

0 comments on commit 3ead8c0

Please sign in to comment.