code: def test_timer_track_stages(tmpdir):
      """Test that the timer tracks time also for other stages (train/val/test)."""
      # note: skipped on windows because time resolution of time.monotonic() is not high enough for this fast test
      model = BoringModel()
      timer = Timer()
      trainer = Trainer(
          default_root_dir=tmpdir, max_steps=5, callbacks=[timer]
      )
      trainer.fit(model)
      assert timer.time_elapsed() == timer.time_elapsed("train") > 0
      assert timer.time_elapsed("validate") > 0
      assert timer.time_elapsed("test") == 0
      trainer.test(model)
      assert timer.time_elapsed("test") > 0
  
imports: import logging
  import time
  from datetime import timedelta
  from unittest.mock import Mock, patch
  import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.callbacks.timer import Timer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 9 for calling a global function with example usage: test_timer_track_stages(tmpdir) without return types