Skip to content

Instantly share code, notes, and snippets.

@epistemery
Created March 11, 2016 11:21
Show Gist options
  • Save epistemery/62b776b5b719f3efaba8 to your computer and use it in GitHub Desktop.
Save epistemery/62b776b5b719f3efaba8 to your computer and use it in GitHub Desktop.
import churro
import transaction
import shutil
import os.path
def test(dbpath):
db = churro.Churro(dbpath)
root = db.root()
root["a"] = churro.Persistent()
transaction.commit()
db = churro.Churro(dbpath)
root = db.root()
del root["a"]
db.flush()
root["b"] = churro.Persistent()
try:
db.flush()
except FileNotFoundError as why:
print(why)
finally:
transaction.abort()
if __name__ == "__main__":
dbpath = "./churrodata"
assert not os.path.exists(dbpath)
try:
test(dbpath)
finally:
shutil.rmtree(dbpath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment