def get_db_version(config, dbtype, args): if os.path.exists(config.get_value("Database", "filename")): dbver = factory.check_db_version(dbtype) if dbver < 0.4 and not args.dbconvert: print(_db_warn) else: dbver = __DB_FORMAT__ return dbver
def test_factory_check_db_file(self): orig_sqlite = getattr(factory, 'sqlite') factory.sqlite = FakeSqlite() self.assertEquals(factory.check_db_version('SQLite'), 0.3) factory.sqlite = orig_sqlite
def test_factory_check_db_ver(self): self.assertEquals(factory.check_db_version('SQLite'), 0.5)
def test_factory_check_db_file(self): factory.create('SQLite', version='0.3', filename='baz.db') self.assertEqual(factory.check_db_version('SQLite', 'baz.db'), 0.3) os.unlink('baz.db')
def test_factory_check_db_ver(self): self.assertEqual(factory.check_db_version('SQLite', testdb), 0.5)
def test_factory_check_db_file(self): fn = os.path.join(os.path.dirname(__file__), 'baz.db') db = factory.createdb('sqlite:///' + os.path.abspath(fn), 0.3) db._open() self.assertEqual(factory.check_db_version('sqlite:///' + fn), 0.3) os.unlink(fn)
def test_factory_check_db_ver(self): self.assertEqual(factory.check_db_version('sqlite://' + testdb), u"'0.6'")
def get_db_version(config, args): dburi = check_db_version(config.get_value("Database", "dburi")) return dburi
def test_factory_check_db_file(self): fn = os.path.join(os.path.dirname(__file__), 'baz.db') db = factory.createdb('sqlite:///'+os.path.abspath(fn), 0.3) db._open() self.assertEqual(factory.check_db_version('sqlite:///'+fn), 0.3) os.unlink(fn)
def test_factory_check_db_ver(self): self.assertEqual(factory.check_db_version('sqlite://'+testdb), u"'0.6'")