Esempio n. 1
0
 def test_copy_to_local(self):
     new_file = HDFS(os.path.join("/tmp", str(uuid.uuid4())))
     local_path = os.path.join("/tmp", "copied_from_hdfs")
     self.assertFalse(os.path.exists(local_path))
     try:
         new_file.create_file()
         self.assertTrue(new_file.exists(), "File was not created")
         new_file.copy_to_local(local_path)
         self.assertTrue(os.path.exists(local_path), "File was not copied from HDFS")
     finally:
         new_file.delete()
         self.assertFalse(new_file.exists(), "File was not removed")
         os.remove(local_path)
         self.assertFalse(os.path.exists(local_path))
Esempio n. 2
0
 def test_copy_to_local(self):
     new_file = HDFS(os.path.join("/tmp", str(uuid.uuid4())))
     local_path = os.path.join("/tmp", "copied_from_hdfs")
     self.assertFalse(os.path.exists(local_path))
     try:
         new_file.create_file()
         self.assertTrue(new_file.exists(), "File was not created")
         new_file.copy_to_local(local_path)
         self.assertTrue(os.path.exists(local_path), "File was not copied from HDFS")
     finally:
         new_file.delete()
         self.assertFalse(new_file.exists(), "File was not removed")
         os.remove(local_path)
         self.assertFalse(os.path.exists(local_path))