Commit ba270780 authored by Elena Grandi's avatar Elena Grandi

Create the directory for a JsonableLog before trying to write it

parent 99573a3e
......@@ -16,6 +16,7 @@ class JsonableLog:
"""
def __init__(self, pathname):
self.pathname = pathname
os.makedirs(os.path.dirname(self.pathname), exist_ok=True)
try:
self.fd = open(self.pathname, "at")
except FileNotFoundError:
......
......@@ -48,4 +48,4 @@ class TestOperationLog(TestCase):
oplog.log(ops.Noop())
oplog.close()
self.assertFalse(os.path.exists(pathname))
self.assertTrue(os.path.exists(pathname))
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