def update_ignorefile(ignorefile): """Check to see if a given file is valid, if not remove it and recreate it. Returns True when newly created, false when all was well.""" if not is_valid_ignorefile(ignorefile): rm(ignorefile, recursive=True) create_ignorefile(ignorefile)
def testLocalMonitor(self): print("Starting local monitor at '{}'...".format(ROOT)) self.lm.start() print("Hello there!") create_file(ROOT, "foo") create_file(ROOT, "bar") create_file(ROOT, "fizz") create_file(ROOT, "fuzz") touch_file(ROOT, "bar", "This is a file called bar.\n") touch_file(ROOT, "bar", "This is a file called bar.\n") folder = join(ROOT, "one") makedirs(folder) another_folder = join(ROOT, "two") makedirs(another_folder) rm(folder) sleep(1) create_file(another_folder, "klm.txt", "Hello there!") create_file(another_folder, "xyz.txt", "I'm created automagically :)") touch_file(another_folder, "xyz.txt", "Some extra text") sleep(1) self.lm.stop()
def _recreate_path(self, path): if exists(path): rm(path, recursive=True) mkdirs(path, parents=True)
def tearDownClass(cls): rm(LOCAL_ROOT_PATH, recursive=True)