MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / test_error_disk_full

Method test_error_disk_full

tests/TestOptions.py:253–264  ·  view source on GitHub ↗

Test graceful degradation when disk is full

(self)

Source from the content-addressed store, hash-verified

251 del opt
252
253 def test_error_disk_full(self):
254 """Test graceful degradation when disk is full"""
255 disk_full_error = OSError('No space left on device')
256 disk_full_error.errno = errno.ENOSPC
257 o = bleachbit.Options.Options()
258 with mock.patch('builtins.open', side_effect=disk_full_error):
259 with self.assertLogs(level='ERROR') as log_context:
260 o.set('test_key', 'test_value')
261 o.commit()
262 self.assertIn('Disk was full', log_context.output[0])
263 self.assertIn(bleachbit.options_file, log_context.output[0])
264 self.assertEqual(o.get('test_key'), 'test_value')
265
266 def test_error_permission(self):
267 """Test graceful degradation with permission errors"""

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
commitMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected