code: def test_flush(self):
      N_TEST = 5
      w = SummaryWriter(flush_secs=20)
      f = w.file_writer.event_writer._ev_writer._file_name
      for i in range(N_TEST):
          w.add_scalar("a", i)
          time.sleep(2)
      w.flush()
      r = PyRecordReader_New(f)
      r.GetNext()  # meta data, so skip
      for _ in range(N_TEST):  # all of the data should be flushed
          r.GetNext()
  
file_path: pytorch-tensorboardx/tests/test_writer.py
imports: from tensorboardX import SummaryWriter
  from tensorboard.compat.tensorflow_stub.pywrap_tensorflow import PyRecordReader_New
  from tensorboardX.proto import event_pb2
  import os
  import numpy
  import pytest
  import unittest
  import time
label_desc: Use image node_id 4 for calling the WriterTest obj's underlying member method code with example usage: obj.test_flush() without return types