code: def test_flush_n_steps(tmp_path):
      logger = CSVLogger(tmp_path, flush_logs_every_n_steps=2)
      metrics = {
          "float": 0.3,
          "int": 1,
          "FloatTensor": torch.tensor(0.1),
          "IntTensor": torch.tensor(1),
      }
      logger.save = MagicMock()
      logger.log_metrics(metrics, step=0)
  
      logger.save.assert_not_called()
      logger.log_metrics(metrics, step=1)
      logger.save.assert_called_once()
  
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 8 for calling a global function with example usage: test_flush_n_steps(tmp_path) without return types