Пример #1
0
 def testWorkerDoesRemoveFilePath(self):
     temp_dir = self.get_temp_dir()
     strategy = DistributedFileUtilsTest.MockedWorkerStrategy()
     dir_to_write = distributed_file_utils.write_dirpath(temp_dir, strategy)
     file_to_write = os.path.join(dir_to_write, 'tmp')
     self.assertFalse(os.path.exists(file_to_write))
     self._write_dummy_file(file_to_write)
     self.assertTrue(os.path.exists(file_to_write))
     distributed_file_utils.remove_temp_dir_with_filepath(
         file_to_write, strategy)
     self.assertFalse(os.path.exists(file_to_write))
Пример #2
0
 def testChiefDoesNotRemoveDirAndFilePath(self):
     temp_dir = self.get_temp_dir()
     strategy = DistributedFileUtilsTest.MockedChiefStrategy()
     dir_to_write = distributed_file_utils.write_dirpath(temp_dir, strategy)
     file_to_write = os.path.join(dir_to_write, "tmp")
     self.assertFalse(os.path.exists(file_to_write))
     self._write_dummy_file(file_to_write)
     self.assertTrue(os.path.exists(file_to_write))
     distributed_file_utils.remove_temp_dir_with_filepath(
         file_to_write, strategy
     )
     self.assertTrue(os.path.exists(file_to_write))