Skip to content

Commit

Permalink
Removed vestigial exception and added final unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cocagne committed Jan 18, 2013
1 parent 100d2e8 commit 03fe214
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 2 additions & 6 deletions paxos/durable.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class HashMismatch (FileCorrupted):
class FileTruncated (FileCorrupted):
pass

class PickleCorrupted (FileCorrupted):
pass


def read( fd ):
Expand Down Expand Up @@ -103,10 +101,8 @@ def read( fd ):
if not m.digest() == md5hash:
raise HashMismatch()

try:
return serial_number, pickle.loads(data3)
except:
raise PickleCorrupted()
return serial_number, pickle.loads(data3)



def write( fd, serial_number, pyobject ):
Expand Down
5 changes: 5 additions & 0 deletions test/test_durable.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def newdoh(self, obj_id=None):
self.dohs.append(doh)
return doh


def test_bad_directory(self):
self.assertRaises(Exception, durable.DurableObjectHandler, '/@#$!$^FOOBARBAZ', 'blah')


def test_no_save(self):
self.doh.close()
d = self.newdoh('id1')
Expand Down

0 comments on commit 03fe214

Please sign in to comment.