Logo Search packages:      
Sourcecode: ubuntuone-dev-tools version File versions  Download package

def ubuntuone::devtools::testcase::BaseTestCase::rmtree (   self,
  path 
) [inherited]
Custom rmtree that handle ro parent(s) and childs.

Definition at line 177 of file testcase.py.

                          :
        """Custom rmtree that handle ro parent(s) and childs."""
        if not os.path.exists(path):
            return
        # change perms to rw, so we can delete the temp dir
        if path != getattr(self, '__root', None):
            os.chmod(os.path.dirname(path), 0755)
        if not os.access(path, os.W_OK):
            os.chmod(path, 0755)
        # pylint: disable=W0612
        for dirpath, dirs, files in os.walk(path):
            for dirname in dirs:
                if not os.access(os.path.join(dirpath, dirname), os.W_OK):
                    os.chmod(os.path.join(dirpath, dirname), 0777)
        shutil.rmtree(path)


Generated by  Doxygen 1.6.0   Back to index