コード例 #1
0
 def test_mkdirs(self):
     try:
         subdir = os.path.join('/tmp', str(random.random()))
         path = os.path.join(subdir, str(random.random()))
         fs.mkdirs(path)
         assert os.path.exists(path)
     finally:
         shutil.rmtree(subdir)
コード例 #2
0
 def test_mkdirs_already_dir(self):
     tmpdir = mkdtemp()
     try:
         fs.mkdirs(tmpdir)
     except (GlusterFileSystemOSError, OSError):
         self.fail("Unexpected exception")
     else:
         pass
     finally:
         shutil.rmtree(tmpdir)
コード例 #3
0
 def test_mkdirs_existing_file_on_path(self):
     tmpdir = mkdtemp()
     fd, tmpfile = mkstemp(dir=tmpdir)
     try:
         fs.mkdirs(os.path.join(tmpfile, 'b'))
     except OSError:
         pass
     else:
         self.fail("Expected GlusterFileSystemOSError exception")
     finally:
         os.close(fd)
         shutil.rmtree(tmpdir)
コード例 #4
0
    def test_mkdirs_DiskFileNoSpace(self):

        with patch('os.makedirs', mock_os_mkdir_makedirs_enospc):
            try:
                fs.mkdirs("blah")
            except DiskFileNoSpace:
                pass
            else:
                self.fail("Expected DiskFileNoSpace exception")

        with patch('os.makedirs', mock_os_mkdir_makedirs_edquot):
            try:
                fs.mkdirs("blah")
            except DiskFileNoSpace:
                pass
            else:
                self.fail("Expected DiskFileNoSpace exception")