fix timers
lint / ruff (push) Failing after 15s
tests / desktop (push) Successful in 21s
tests / web (push) Successful in 46s
docker / image (push) Failing after 1m31s
tests / android-core (push) Successful in 1m5s
tests / backend (push) Successful in 2m33s
android / apk (push) Successful in 4m34s
lint / ruff (push) Failing after 15s
tests / desktop (push) Successful in 21s
tests / web (push) Successful in 46s
docker / image (push) Failing after 1m31s
tests / android-core (push) Successful in 1m5s
tests / backend (push) Successful in 2m33s
android / apk (push) Successful in 4m34s
This commit is contained in:
30 files changed
+3331
-419
No files matched your search
@@ -69,6 +69,40 @@ def test_auto_start_breaks_rolls_straight_on(session, settings):
|
||||
assert follow_on is not None and follow_on.kind == "short_break"
|
||||
|
||||
|
||||
def test_a_complete_naming_a_finished_interval_does_nothing(session, settings):
|
||||
"""Two clients reaching zero at once must not cost you the break.
|
||||
|
||||
Every client ticks its own countdown and calls `complete` when it runs out.
|
||||
The first call finishes the work interval and auto-starts the break; the
|
||||
second — sent a moment earlier, from a client that has not polled since —
|
||||
used to finish *that* break, so a break ended the instant it began.
|
||||
"""
|
||||
settings.pomodoro.auto_start_breaks = True
|
||||
settings.pomodoro.auto_start_work = True
|
||||
settings_service.save_settings(session, settings)
|
||||
|
||||
work = pomodoro.start(session, settings, kind="work")
|
||||
finished, follow_on = pomodoro.complete(session, settings, expect_id=work.id)
|
||||
assert finished is not None and follow_on is not None
|
||||
assert follow_on.kind == "short_break"
|
||||
|
||||
# The second client's call, naming the work interval it was still showing.
|
||||
stale_finished, stale_follow_on = pomodoro.complete(session, settings, expect_id=work.id)
|
||||
assert stale_finished is None and stale_follow_on is None
|
||||
|
||||
still_running = pomodoro.current_session(session)
|
||||
assert still_running is not None
|
||||
assert still_running.id == follow_on.id and still_running.status == "running"
|
||||
|
||||
|
||||
def test_complete_without_a_session_id_stays_unconditional(session, settings):
|
||||
settings.pomodoro.auto_start_breaks = False
|
||||
settings_service.save_settings(session, settings)
|
||||
pomodoro.start(session, settings, kind="work")
|
||||
finished, _ = pomodoro.complete(session, settings)
|
||||
assert finished is not None and finished.status == "completed"
|
||||
|
||||
|
||||
def test_strict_mode_demands_a_reason(session, settings):
|
||||
settings.pomodoro.strict_mode = True
|
||||
settings_service.save_settings(session, settings)
|
||||
|
||||
Reference in new issue
Block a user