def test_eval_epoch_only_logging(tmp_path, 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=tmp_path,
        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}
Tests that on_test_epoch_end can be used to log, and we return them in the results.
tests/tests_pytorch/trainer/logging_/test_eval_loop_logging.py