예제 #1
0
파일: _hdfs_test.py 프로젝트: vivshri/luigi
 def test_mkdir_exists(self):
     path = "/tmp/luigi_hdfs_testdir"
     if not hdfs.exists(path):
         hdfs.mkdir(path)
     self.assertTrue(hdfs.exists(path))
     self.assertRaises(luigi.target.FileAlreadyExists, hdfs.mkdir, path)
     hdfs.remove(path, skip_trash=True)
예제 #2
0
    def test_with_close(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath)

        with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
            fobj.write('hej')

        self.assertTrue(hdfs.exists(testpath))
예제 #3
0
    def test_atomicity(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath)

        pipe = hdfs.HdfsAtomicWritePipe(testpath)
        self.assertFalse(hdfs.exists(testpath))
        pipe.close()
        self.assertTrue(hdfs.exists(testpath))
예제 #4
0
파일: _hdfs_test.py 프로젝트: jwills/luigi
    def test_with_close(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath)

        with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
            fobj.write("hej")

        self.assertTrue(hdfs.exists(testpath))
예제 #5
0
파일: _hdfs_test.py 프로젝트: jwills/luigi
    def test_atomicity(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath)

        pipe = hdfs.HdfsAtomicWritePipe(testpath)
        self.assertFalse(hdfs.exists(testpath))
        pipe.close()
        self.assertTrue(hdfs.exists(testpath))
예제 #6
0
 def test_create_parents(self):
     parent = "luigi_hdfs_testdir"
     target = hdfs.HdfsTarget("%s/testfile" % parent)
     if hdfs.exists(parent):
         hdfs.remove(parent)
     self.assertFalse(hdfs.exists(parent))
     fobj = target.open('w')
     fobj.write('lol\n')
     fobj.close()
     self.assertTrue(hdfs.exists(parent))
     self.assertTrue(target.exists())
예제 #7
0
파일: _hdfs_test.py 프로젝트: jwills/luigi
 def test_create_parents(self):
     parent = "luigi_hdfs_testdir"
     target = hdfs.HdfsTarget("%s/testfile" % parent)
     if hdfs.exists(parent):
         hdfs.remove(parent)
     self.assertFalse(hdfs.exists(parent))
     fobj = target.open("w")
     fobj.write("lol\n")
     fobj.close()
     self.assertTrue(hdfs.exists(parent))
     self.assertTrue(target.exists())
예제 #8
0
파일: _hdfs_test.py 프로젝트: DavW/luigi
    def test_with_noclose(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath, skip_trash=True)

        def foo():
            with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
                fobj.write('hej')
                raise TestException('Test triggered exception')
        self.assertRaises(TestException, foo)
        self.assertFalse(hdfs.exists(testpath))
예제 #9
0
파일: _hdfs_test.py 프로젝트: DavW/luigi
 def test_mkdir_exists(self):
     path = "/tmp/luigi_hdfs_testdir"
     if not hdfs.exists(path):
         hdfs.mkdir(path)
     self.assertTrue(hdfs.exists(path))
     self.assertRaises(
         luigi.target.FileAlreadyExists,
         hdfs.mkdir,
         path
     )
     hdfs.remove(path, skip_trash=True)
예제 #10
0
    def test_with_noclose(self):
        testpath = "luigi_hdfs_testfile"
        if hdfs.exists(testpath):
            hdfs.remove(testpath)

        def foo():
            with hdfs.HdfsAtomicWritePipe(testpath) as fobj:
                fobj.write('hej')
                raise TestException('Test triggered exception')
        self.assertRaises(TestException, foo)
        self.assertFalse(hdfs.exists(testpath))
예제 #11
0
    def test_rename_no_parent(self):
        if hdfs.exists("foo"):
            hdfs.remove("foo")

        target1 = hdfs.HdfsTarget(is_tmp=True)
        target2 = hdfs.HdfsTarget("foo/bar")
        with target1.open('w'):
            pass
        self.assertTrue(target1.exists())
        target1.move(target2.path)
        self.assertFalse(target1.exists())
        self.assertTrue(target2.exists())
예제 #12
0
파일: _hdfs_test.py 프로젝트: jwills/luigi
    def test_rename_no_parent(self):
        if hdfs.exists("foo"):
            hdfs.remove("foo")

        target1 = hdfs.HdfsTarget(is_tmp=True)
        target2 = hdfs.HdfsTarget("foo/bar")
        with target1.open("w"):
            pass
        self.assertTrue(target1.exists())
        target1.move(target2.path)
        self.assertFalse(target1.exists())
        self.assertTrue(target2.exists())
예제 #13
0
파일: _hdfs_test.py 프로젝트: DavW/luigi
 def setUp(self):
     self.path = "luigi_hdfs_testfile"
     if hdfs.exists(self.path):
         hdfs.remove(self.path, skip_trash=True)
예제 #14
0
 def setUp(self):
     self.path = "luigi_hdfs_testfile"
     if hdfs.exists(self.path):
         hdfs.remove(self.path)
예제 #15
0
파일: _hdfs_test.py 프로젝트: vivshri/luigi
 def setUp(self):
     self.path = "luigi_hdfs_testfile"
     if hdfs.exists(self.path):
         hdfs.remove(self.path, skip_trash=True)
예제 #16
0
 def setUp(self):
     self.path = "luigi_hdfs_testfile"
     if hdfs.exists(self.path):
         hdfs.remove(self.path)