Test graceful degradation when disk is full
(self)
| 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""" |