def test_timer_zero_duration_stop(tmp_path, interval):
    """Test that the timer stops training immediately after the first check occurs."""
    model = BoringModel()
    duration = timedelta(0)
    timer = Timer(duration=duration, interval=interval)
    trainer = Trainer(default_root_dir=tmp_path, callbacks=[timer])
    trainer.fit(model)
    assert trainer.global_step == 0
    assert trainer.current_epoch == 0
Test that the timer stops training immediately after the first check occurs.
tests/tests_pytorch/callbacks/test_timer.py