Example #1
0
    def test_target_path_exists(self):
        with hdfs.HdfsAtomicWriteDirPipe(self.path) as fobj:
            fobj.write(b'test1')
        with hdfs.HdfsAtomicWritePipe(self.path) as fobj:
            fobj.write(b'test2')

        with HdfsReadPipe(self.path) as read_pipe:
            contents = read_pipe.read()

        self.assertEqual(b'test2', contents)
Example #2
0
    def test_target_path_exists(self):
        testpath = self._test_file()
        try:
            if self.fs.exists(testpath):
                self.fs.remove(testpath, skip_trash=True)
        except BaseException:
            if self.fs.exists(self._test_dir()):
                self.fs.remove(self._test_dir(), skip_trash=True)

        with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
            fobj.write(b'test1')
        with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
            fobj.write(b'test2')

        with HdfsReadPipe(testpath) as read_pipe:
            contents = read_pipe.read()

        self.assertEqual(b'test2', contents)