Properly report open mode to transaction stores.
The mode was always being reported as "w" (write), which resulted in SHA-256 checksums not being validated on load. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This commit is contained in:
parent
3d39ca84e6
commit
450bf7ff6a
2 changed files with 2 additions and 3 deletions
|
|
@ -210,12 +210,12 @@ class FileFormat:
|
|||
self._txnstore = txn
|
||||
self._options = options or {}
|
||||
def _open(self, mode):
|
||||
self._txnstore.prepare_open(self._filename, "w")
|
||||
self._txnstore.prepare_open(self._filename, mode)
|
||||
if self._isfp:
|
||||
fp = self._file
|
||||
else:
|
||||
fp = open(self._filename, mode)
|
||||
self._txnstore.commit_open(self._filename, "w")
|
||||
self._txnstore.commit_open(self._filename, mode)
|
||||
return fp
|
||||
def _close(self, fp):
|
||||
self._txnstore.prepare_close()
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ class SHA256TransactionTest(unittest.TestCase):
|
|||
x.tempfile = self.create_small_database(x.tempdir)
|
||||
x.fs = FileStorage("csv", x.tempfile, "sha256", *args)
|
||||
return x
|
||||
@unittest.expectedFailure
|
||||
def test_missing_not_forgiving(self):
|
||||
x = self.create_filestorage({"forgiving": False})
|
||||
with self.assertRaisesRegex(newfol.exception.UpgradeNeededError,
|
||||
|
|
|
|||
Loading…
Reference in a new issue