Esempio n. 1
0
 def test_version(self):
     tdb = TemporaryDatabase()
     self.assertEqual(Database.read_version(tdb.ddir.name),
                      DatabaseVersion())
     tdb.db.store()
     tdb.db.upgrade()
     self.assertEqual(Database.read_version(tdb.ddir.name),
                      DatabaseVersion.preferred())
Esempio n. 2
0
 def do_upgrade_test(self, version, pattern):
     tdb = TemporaryDatabase("txn:git\n")
     ddir, db = tdb.ddir, tdb.db
     if not isinstance(version, DatabaseVersion):
         version = DatabaseVersion(version)
     self.assertEqual(Database.read_version(ddir.name),
                      DatabaseVersion())
     db.store()
     db.upgrade(version=version)
     self.assertEqual(Database.read_version(ddir.name),
                      version)
     with open(ddir.name + "/dtb", "rb") as fp:
         data = fp.read(len(pattern))
         self.assertEqual(data, pattern)
     ddir.cleanup()