Created
March 11, 2016 11:21
-
-
Save epistemery/62b776b5b719f3efaba8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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