code: def test_warning_invalid_trainstep_output(tmpdir):
      class InvalidTrainStepModel(BoringModel):
          def __init__(self):
              super().__init__()
              self.automatic_optimization = False
  
          def training_step(self, batch, batch_idx):
              return 5
  
      model = InvalidTrainStepModel()
      trainer = Trainer(default_root_dir=tmpdir, fast_dev_run=1)
  
      with pytest.raises(
          MisconfigurationException,
          match="return a Tensor or have no return",
      ):
          trainer.fit(model)
  
file_path: pytorch-lightning/tests/tests_pytorch/loops/optimization/test_manual_loop.py
imports: import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loops.optimization.manual import ManualResult
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 2 for calling a global function with example usage: test_warning_invalid_trainstep_output(tmpdir) and returns: int