Esempio n. 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)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
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)
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
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")
Esempio n. 8
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")