code: def test_training_step_no_return_when_even(tmpdir):
      """Tests correctness when some training steps have been skipped."""
  
      class TestModel(BoringModel):
          def training_step(self, batch, batch_idx):
              self.training_step_called = True
              loss = self.step(batch[0])
              self.log("a", loss, on_step=True, on_epoch=True)
              return loss if batch_idx % 2 else None
  
      model = TestModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          limit_train_batches=4,
          limit_val_batches=1,
          max_epochs=4,
          enable_model_summary=False,
          logger=False,
          enable_checkpointing=False,
      )
  
      Closure.warning_cache.clear()
  
      with pytest.warns(
          UserWarning, match=r".*training_step` returned `None.*"
      ):
          trainer.fit(model)
  
      trainer.state.stage = RunningStage.TRAINING
  
      # manually check a few batches
      for batch_idx, batch in enumerate(model.train_dataloader()):
          kwargs = {"batch": batch, "batch_idx": batch_idx}
          out = trainer.fit_loop.epoch_loop.automatic_optimization.run(
              trainer.optimizers[0], batch_idx, kwargs
          )
          if not batch_idx % 2:
              assert out == {}
  
file_path: pytorch-lightning/tests/tests_pytorch/loops/test_training_loop_flow_scalar.py
imports: import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.core.module import LightningModule
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.loops.optimization.automatic import Closure
  from lightning.pytorch.trainer.states import RunningStage
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  from torch.utils.data import DataLoader
  from torch.utils.data._utils.collate import default_collate
  from tests_pytorch.helpers.deterministic_model import DeterministicModel
label_desc: Use image node_id 5 for calling a global function with example usage: test_training_step_no_return_when_even(tmpdir) and returns: unknown