Update tests/test_utils_run_later.py
Run CI Tests / test (push) Successful in 1m40s

This commit is contained in:
2025-08-04 18:06:24 +02:00
parent ca94ffb283
commit fb7bab990e
+6 -6
View File
@@ -32,9 +32,9 @@ def test_run_at(monkeypatch, capsys):
fake_dt = FakeDatetime(base)
# Patch dependencies to control time and disable delays
monkeypatch.setattr("slic.utils.time_runner.datetime", fake_dt)
monkeypatch.setattr("slic.utils.time_runner.sleep", lambda x: None)
monkeypatch.setattr("slic.utils.time_runner.tqdm_mod", lambda *a, **k: DummyBar())
monkeypatch.setattr("slic.utils.run_later.datetime", fake_dt)
monkeypatch.setattr("slic.utils.run_later.sleep", lambda x: None)
monkeypatch.setattr("slic.utils.run_later.tqdm_mod", lambda *a, **k: DummyBar())
# Should NOT trigger because the target time is in the future
run_at(base + timedelta(seconds=30), fexample, "not yet")
@@ -97,9 +97,9 @@ def test_run_later(monkeypatch, capsys):
fake_dt = FakeDatetime(base)
# Patch for control over time and sleeping
monkeypatch.setattr("slic.utils.time_runner.datetime", fake_dt)
monkeypatch.setattr("slic.utils.time_runner.sleep", lambda x: None)
monkeypatch.setattr("slic.utils.time_runner.tqdm_mod", lambda *a, **k: DummyBar())
monkeypatch.setattr("slic.utils.run_later.datetime", fake_dt)
monkeypatch.setattr("slic.utils.run_later.sleep", lambda x: None)
monkeypatch.setattr("slic.utils.run_later.tqdm_mod", lambda *a, **k: DummyBar())
# Run using float seconds : should not trigger yet
run_later(15, fexample, "15s later")