code: def test_automatic_step_tracking(tmp_path):
      """Test that the logger keeps track of the step value if it isn't passed in explicitly."""
      logger = CSVLogger(tmp_path, flush_logs_every_n_steps=3)
      logger.save = MagicMock()
      metrics = {"test": 0.1}
      logger.log_metrics(metrics, step=None)
      logger.save.assert_not_called()
      assert logger.experiment.metrics[0]["step"] == 0
      logger.log_metrics(metrics, step=None)
      logger.save.assert_not_called()
      assert logger.experiment.metrics[1]["step"] == 1
      logger.log_metrics(metrics, step=None)
      logger.save.assert_called_once()
      assert logger.experiment.metrics[2]["step"] == 2
  
file_path: pytorch-lightning/tests/tests_fabric/loggers/test_csv.py
imports: import os
  from unittest.mock import MagicMock
  import pytest
  import torch
  from lightning.fabric.loggers import CSVLogger
  from lightning.fabric.loggers.csv_logs import _ExperimentWriter
label_desc: Use image node_id 10 for calling a global function with example usage: test_automatic_step_tracking(tmp_path) without return types