Exceptions when closing a file

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Mar 20 18:19:27 EDT 2007


John Nagle <nagle at animats.com> writes:

>      If you want to force [an error while closing a file], write to
> a drive reached over a network, or a removable medium like a floppy
> or flash card.  Open a file for writing and disconnect the network
> or remove the removable medium.

Or simply use a mock library, create a mock file object, and guarantee
(for the purpose of your unit test) that it *will* raise the
appropriate error without interacting with the rest of the system.

-- 
 \     "Ours is a world where people don't know what they want and are |
  `\    willing to go through hell to get it."  -- Donald Robert Perry |
_o__)                                                          Marquis |
Ben Finney




More information about the Python-list mailing list