code: def test_eval_epoch_only_logging(
      tmpdir, batches, log_interval, max_epochs
  ):
      """Tests that on_test_epoch_end can be used to log, and we return them in the results."""
  
      class TestModel(BoringModel):
          def on_test_epoch_end(self):
              self.log("c", torch.tensor(2))
              self.log("d/e/f", 2)
  
      model = TestModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=max_epochs,
          limit_test_batches=batches,
          log_every_n_steps=log_interval,
          enable_model_summary=False,
      )
      results = trainer.test(model)
  
      assert len(results) == 1
      assert results[0] == {"c": torch.tensor(2), "d/e/f": 2}
  
imports: import collections
  import itertools
  import os
  from contextlib import redirect_stdout
  from io import StringIO
  from unittest import mock
  from unittest.mock import ANY, call
  import numpy
  import pytest
  import torch
  from lightning.fabric.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0
  from lightning.pytorch import Trainer, callbacks
  from lightning.pytorch.callbacks.progress.rich_progress import _RICH_AVAILABLE
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.loggers import TensorBoardLogger
  from lightning.pytorch.loops import _EvaluationLoop
  from lightning.pytorch.trainer.states import RunningStage
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import Tensor
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 6 for calling a global function with example usage: test_eval_epoch_only_logging(tmpdir, batches, log_interval, max_epochs) without return types