Ejemplo n.º 1
0
    def test_remove_deep_dir(self):
        """test the deletion of a deep directory tree."""
        path = self.testDir
        for d in xrange(1,10): path = os.path.join(path, "dir-%d" % d)

        self.assertFalse(os.access(path, os.F_OK))
        self._makeDir(path)
        self.assertTrue(os.access(path, os.F_OK))
        util.removeDirCompletely(self.testDir)
        self.assertFalse(os.access(path, os.F_OK))
Ejemplo n.º 2
0
    def test_remove_non_empty_dir(self):
        """tests the deletion of a directory tree."""
        subds = [ "dir-%d" % i for i in range(1,10) ]
        files = [ "file-%d" % i for i in xrange(1,10) ]

        for d in subds: self._makeDir(os.path.join(self.testDir, d))
        for f in files: open(os.path.join(self.testDir, f), "wb").write("test")

        self.assertTrue(os.access(self.testDir, os.F_OK))
        for d in subds:
            self.assertTrue(os.access(os.path.join(self.testDir, d), os.F_OK))
        for f in files:
            self.assertTrue(os.access(os.path.join(self.testDir, f), os.F_OK))
        util.removeDirCompletely(self.testDir)
        for d in subds:
            self.assertFalse(os.access(os.path.join(self.testDir, d), os.F_OK))
        for f in files:
            self.assertFalse(os.access(os.path.join(self.testDir, f), os.F_OK))
        self.assertFalse(os.access(self.testDir, os.F_OK))
Ejemplo n.º 3
0
 def cleanUp(self):
     """cleans up the task, i.e. removes the task's spool directory"""
     self.log.info("removing spool directory")
     from xbe.util import removeDirCompletely
     removeDirCompletely(self.__spool)
Ejemplo n.º 4
0
 def test_remove_non_existent_dir(self):
     nonexistent = os.path.join(self.testDir, "nonexistent")
     self.assertFalse(os.access(nonexistent, os.F_OK))
     util.removeDirCompletely(nonexistent)
     self.assertFalse(os.access(nonexistent, os.F_OK))
Ejemplo n.º 5
0
 def test_remove_empty_dir(self):
     """tests the deletion of a directory."""
     self._makeDir(self.testDir)
     self.assertTrue(os.access(self.testDir, os.F_OK))
     util.removeDirCompletely(self.testDir)
     self.assertFalse(os.access(self.testDir, os.F_OK))
Ejemplo n.º 6
0
 def tearDown(self):
     removeDirCompletely(self.cacheDir)