diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/common/test_fs_utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/common/test_fs_utils.py b/test/unit/common/test_fs_utils.py index 6e05ad3..4bd0712 100644 --- a/test/unit/common/test_fs_utils.py +++ b/test/unit/common/test_fs_utils.py @@ -566,6 +566,19 @@ class TestFsUtils(unittest.TestCase): finally: os.remove(tmpfile) + def test_do_close_err_ENOSPC(self): + + def _mock_os_close_enospc(fd): + raise OSError(errno.ENOSPC, os.strerror(errno.ENOSPC)) + + fd, tmpfile = mkstemp() + try: + with patch('os.close', _mock_os_close_enospc): + self.assertRaises(DiskFileNoSpace, fs.do_close, fd) + finally: + os.close(fd) + os.remove(tmpfile) + def test_do_unlink(self): fd, tmpfile = mkstemp() try: |