def copy(self): local_fs = hdfs.hdfs("", 0) local_wd = utils.make_wd(local_fs) from_path = os.path.join(local_wd, uuid.uuid4().hex) content = uuid.uuid4().hex with open(from_path, "w") as f: f.write(content) to_path = self._make_random_file() local_fs.copy(from_path, self.fs, to_path) self.assertRaises(ValueError, local_fs.copy, "", self.fs, "") local_fs.close() with self.fs.open_file(to_path) as f: self.assertEqual(f.read(), content) shutil.rmtree(local_wd)
def copy(self): local_fs = hdfs.hdfs('', 0) local_wd = utils.make_wd(local_fs) from_path = os.path.join(local_wd, uuid.uuid4().hex) content = uuid.uuid4().hex with open(from_path, "w") as f: f.write(content) to_path = self._make_random_file() local_fs.copy(from_path, self.fs, to_path) self.assertRaises(ValueError, local_fs.copy, "", self.fs, "") local_fs.close() with self.fs.open_file(to_path) as f: self.assertEqual(f.read(), content) shutil.rmtree(local_wd)
def setUp(self): self.fs = hdfs.hdfs(self.hdfs_host, self.hdfs_port) self.wd = utils.make_wd(self.fs)
def setUp(self): self.fs = hdfs() self.wd = utils.make_wd(self.fs)