Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Return os.unlink to clean up temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
thobrla committed Nov 16, 2015
1 parent 65f0a8b commit e90ec58
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_multistore_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ def test_lock_file_raises_ioerror(self):
filehandle, filename = tempfile.mkstemp()
os.close(filehandle)

for error_code in (errno.EDEADLK, errno.ENOSYS, errno.ENOLCK):
multistore = multistore_file._MultiStore(filename)
multistore._file = _MockLockedFile(filename, error_code)
# Should not raise even though the underlying file class did.
multistore._lock()
self.assertTrue(multistore._file.open_and_lock_called)
try:
for error_code in (errno.EDEADLK, errno.ENOSYS, errno.ENOLCK):
multistore = multistore_file._MultiStore(filename)
multistore._file = _MockLockedFile(filename, error_code)
# Should not raise even though the underlying file class did.
multistore._lock()
self.assertTrue(multistore._file.open_and_lock_called)
finally:
os.unlink(filename)

0 comments on commit e90ec58

Please sign in to comment.