code: def test_recopy(_temp_analyze_files):
      # Re-copying with the same parameters on an unchanged file should be
      # idempotent
      #
      # Test for copying from regular files and symlinks
      orig_img, orig_hdr = _temp_analyze_files
      pth, fname = os.path.split(orig_img)
      img_link = os.path.join(pth, "imglink.img")
      new_img = os.path.join(pth, "newfile.img")
      new_hdr = os.path.join(pth, "newfile.hdr")
      copyfile(orig_img, img_link)
      for copy in (True, False):
          for use_hardlink in (True, False):
              for hashmethod in ("timestamp", "content"):
                  kwargs = {
                      "copy": copy,
                      "use_hardlink": use_hardlink,
                      "hashmethod": hashmethod,
                  }
                  # Copying does not preserve the original file's timestamp, so
                  # we may delete and re-copy, if the test is slower than a clock
                  # tick
                  if (
                      copy
                      and not use_hardlink
                      and hashmethod == "timestamp"
                  ):
                      continue
  
                  copyfile(orig_img, new_img, **kwargs)
                  img_stat = _ignore_atime(os.stat(new_img))
                  hdr_stat = _ignore_atime(os.stat(new_hdr))
                  copyfile(orig_img, new_img, **kwargs)
                  err_msg = (
                      "Regular - OS: {}; Copy: {}; Hardlink: {}".format(
                          os.name, copy, use_hardlink
                      )
                  )
                  assert img_stat == _ignore_atime(
                      os.stat(new_img)
                  ), err_msg
                  assert hdr_stat == _ignore_atime(
                      os.stat(new_hdr)
                  ), err_msg
                  os.unlink(new_img)
                  os.unlink(new_hdr)
  
                  copyfile(img_link, new_img, **kwargs)
                  img_stat = _ignore_atime(os.stat(new_img))
                  hdr_stat = _ignore_atime(os.stat(new_hdr))
                  copyfile(img_link, new_img, **kwargs)
                  err_msg = (
                      "Symlink - OS: {}; Copy: {}; Hardlink: {}".format(
                          os.name, copy, use_hardlink
                      )
                  )
                  assert img_stat == _ignore_atime(
                      os.stat(new_img)
                  ), err_msg
                  assert hdr_stat == _ignore_atime(
                      os.stat(new_hdr)
                  ), err_msg
                  os.unlink(new_img)
                  os.unlink(new_hdr)
  
imports: import os
  import time
  from pathlib import Path
  from unittest import mock, SkipTest
  import pytest
  from ...testing import TempFATFS
  from ...utils.filemanip import save_json, load_json, fname_presuffix, fnames_presuffix, hash_rename, check_forhash, _parse_mount_table, _cifs_table, on_cifs, copyfile, copyfiles, ensure_list, simplify_list, check_depends, split_filename, get_related_files, indirectory, loadpkl, loadcrash, savepkl, path_resolve, write_rst_list, emptydirs
label_desc: Use image node_id 13 for calling a global function with example usage: test_recopy(_temp_analyze_files) without return types