docstr: Temporary filesystem for testing non-POSIX filesystems on a POSIX
  system.
  
  with TempFATFS() as fatdir:
      target = os.path.join(fatdir, 'target')
      copyfile(file1, target, copy=False)
      assert not os.path.islink(target)
  
  Arguments
  ---------
  size_in_mbytes : int
      Size (in MiB) of filesystem to create
  delay : float
      Time (in seconds) to wait for fusefat to start, stop
docstr_tok: ["Temporary","filesystem","for","testing","non-POSIX","filesystems","on","a","POSIX","system",".","with","TempFATFS","(",")","as","fatdir",":","target","=","os.path.join","(","fatdir",",","'target","'",")","copyfile","(","file1",",","target",",","copy=False",")","assert","not","os.path.islink","(","target",")","Arguments","--","--","--","--","-","size_in_mbytes",":","int","Size","(","in","MiB",")","of","filesystem","to","create","delay",":","float","Time","(","in","seconds",")","to","wait","for","fusefat","to","start",",","stop"]
code: def __init__(self, size_in_mbytes=8, delay=0.5):
      """Temporary filesystem for testing non-POSIX filesystems on a POSIX
      system.
  
      with TempFATFS() as fatdir:
          target = os.path.join(fatdir, 'target')
          copyfile(file1, target, copy=False)
          assert not os.path.islink(target)
  
      Arguments
      ---------
      size_in_mbytes : int
          Size (in MiB) of filesystem to create
      delay : float
          Time (in seconds) to wait for fusefat to start, stop
      """
      self.delay = delay
      self.tmpdir = mkdtemp()
      self.dev_null = open(os.devnull, "wb")
  
      vfatfile = os.path.join(self.tmpdir, "vfatblock")
      self.vfatmount = os.path.join(self.tmpdir, "vfatmount")
      self.canary = os.path.join(self.vfatmount, ".canary")
  
      with open(vfatfile, "wb") as fobj:
          fobj.write(b"\x00" * (int(size_in_mbytes) << 20))
      os.mkdir(self.vfatmount)
  
      mkfs_args = ["mkfs.vfat", vfatfile]
      mount_args = [
          "fusefat",
          "-o",
          "rw+",
          "-f",
          vfatfile,
          self.vfatmount,
      ]
  
      try:
          subprocess.check_call(
              args=mkfs_args, stdout=self.dev_null, stderr=self.dev_null
          )
      except CalledProcessError as e:
          raise OSError("mkfs.vfat failed") from e
  
      try:
          self.fusefat = subprocess.Popen(
              args=mount_args,
              stdout=self.dev_null,
              stderr=self.dev_null,
          )
      except OSError as e:
          raise OSError("fusefat is not installed") from e
  
      time.sleep(self.delay)
  
      if self.fusefat.poll() is not None:
          raise OSError("fusefat terminated too soon")
  
      open(self.canary, "wb").close()
  
file_path: nipype/nipype/testing/utils.py
imports: import os
  import time
  import shutil
  import signal
  import subprocess
  from subprocess import CalledProcessError
  from tempfile import mkdtemp
  from ..utils.misc import package_check
  import numpy
  import nibabel
label_desc: Use image node_id 1 to create a new TempFATFS object  with example: obj = TempFATFS(size_in_mbytes, delay)