Example #1
0
def tmpdir(request):
    path = os.path.realpath(shell.mkdtemp())

    def finalizer():
        shell.rm(path, recursive=True)

    request.addfinalizer(finalizer)
    return path
 def setUp(self):
     global temp_dir
     temp_dir = mkdtemp()
  touch,\
  rm,\
  mv

from watchdog.events import DirModifiedEvent, DirCreatedEvent,\
  FileCreatedEvent,\
  FileMovedEvent, FileModifiedEvent, DirMovedEvent, FileDeletedEvent,\
  DirDeletedEvent

from watchdog.observers.api import ObservedWatch
from watchdog.utils import platform

if platform.is_windows():
  from watchdog.observers.read_directory_changes import WindowsApiEmitter as Emitter

  temp_dir = mkdtemp()

  def p(*args):
    """
    Convenience function to join the temporary directory path
    with the provided arguments.
    """
    return os.path.join(temp_dir, *args)

  class TestWindowsApiEmitter(unittest2.TestCase):
    def setUp(self):
      self.event_queue = queue.Queue()
      self.watch = ObservedWatch(temp_dir, True)
      self.emitter = Emitter(self.event_queue, self.watch, timeout=0.2)

    def teardown(self):
 def setUp(self):
     global temp_dir
     temp_dir = mkdtemp()