Commit 78da33dc authored by Tim Peters's avatar Tim Peters

testNoDamage: ensure that 0 bytes were removed by recovery, not just

that the number of bytes removed ends with "0".

Other tests:  if the output doesn't contain 'error', show the actual
output.
parent 5241bec0
...@@ -101,13 +101,13 @@ class RecoverTest(unittest.TestCase): ...@@ -101,13 +101,13 @@ class RecoverTest(unittest.TestCase):
def testNoDamage(self): def testNoDamage(self):
output = self.recover() output = self.recover()
self.assert_('error' not in output, output) self.assert_('error' not in output, output)
self.assert_('0 bytes removed during recovery' in output, output) self.assert_('\n0 bytes removed during recovery' in output, output)
def testOneBlock(self): def testOneBlock(self):
for i in range(self.ITERATIONS): for i in range(self.ITERATIONS):
self.damage(1, 1024) self.damage(1, 1024)
output = self.recover() output = self.recover()
self.assert_('error' in output) self.assert_('error' in output, output)
self.recovered = FileStorage(self.dest) self.recovered = FileStorage(self.dest)
self.recovered.close() self.recovered.close()
os.remove(self.path) os.remove(self.path)
...@@ -117,7 +117,7 @@ class RecoverTest(unittest.TestCase): ...@@ -117,7 +117,7 @@ class RecoverTest(unittest.TestCase):
for i in range(self.ITERATIONS): for i in range(self.ITERATIONS):
self.damage(4, 512) self.damage(4, 512)
output = self.recover() output = self.recover()
self.assert_('error' in output) self.assert_('error' in output, output)
self.recovered = FileStorage(self.dest) self.recovered = FileStorage(self.dest)
self.recovered.close() self.recovered.close()
os.remove(self.path) os.remove(self.path)
...@@ -127,7 +127,7 @@ class RecoverTest(unittest.TestCase): ...@@ -127,7 +127,7 @@ class RecoverTest(unittest.TestCase):
for i in range(self.ITERATIONS): for i in range(self.ITERATIONS):
self.damage(1, 32 * 1024) self.damage(1, 32 * 1024)
output = self.recover() output = self.recover()
self.assert_('error' in output) self.assert_('error' in output, output)
self.recovered = FileStorage(self.dest) self.recovered = FileStorage(self.dest)
self.recovered.close() self.recovered.close()
os.remove(self.path) os.remove(self.path)
...@@ -153,7 +153,7 @@ class RecoverTest(unittest.TestCase): ...@@ -153,7 +153,7 @@ class RecoverTest(unittest.TestCase):
f.write("\0" * 100) f.write("\0" * 100)
f.close() f.close()
output = self.recover() output = self.recover()
self.assert_('error' in output) self.assert_('error' in output, output)
self.recovered = FileStorage(self.dest) self.recovered = FileStorage(self.dest)
self.recovered.close() self.recovered.close()
os.remove(self.path) os.remove(self.path)
...@@ -165,7 +165,7 @@ class RecoverTest(unittest.TestCase): ...@@ -165,7 +165,7 @@ class RecoverTest(unittest.TestCase):
f.write("\0" * 100) f.write("\0" * 100)
f.close() f.close()
output = self.recover() output = self.recover()
self.assert_('error' in output) self.assert_('error' in output, output)
self.recovered = FileStorage(self.dest) self.recovered = FileStorage(self.dest)
self.recovered.close() self.recovered.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment