code: def test_log_epoch_metrics_before_on_evaluation_end(
      update_eval_epoch_metrics_mock, tmpdir
  ):
      """Test that the epoch metrics are logged before the `on_evaluation_end` hook is fired."""
      order = []
      update_eval_epoch_metrics_mock.side_effect = (
          lambda _: order.append("log_epoch_metrics")
      )
  
      class LessBoringModel(BoringModel):
          def on_validation_end(self):
              order.append("on_validation_end")
              super().on_validation_end()
  
      trainer = Trainer(
          default_root_dir=tmpdir,
          fast_dev_run=1,
          enable_model_summary=False,
          num_sanity_val_steps=0,
      )
      trainer.fit(LessBoringModel())
  
      assert order == ["log_epoch_metrics", "on_validation_end"]
  
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric.accelerators.cuda import _clear_cuda_memory
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.utilities import CombinedLoader
  from torch.utils.data.dataloader import DataLoader
  from torch.utils.data.sampler import BatchSampler, RandomSampler
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 3 for calling a global function with example usage: test_log_epoch_metrics_before_on_evaluation_end(update_eval_epoch_metrics_mock, tmpdir) without return types