self.dba = fmt.dbcreate(None, sa) from Pyblio import Registry Registry.reset() Registry.load_settings(pybut.src('ut_adapter')) dest = Adapter.adapt_schema(self.dba, 'b') self.failUnlessEqual(dest.schema.id, 'b') class TestAdapters(pybut.TestCase): def setUp(self): Registry.load_default_settings() def tearDown(self): Registry.reset() def check(self, name, schema): src = Store.get('file').dbopen( pybut.src('ut_adapter/' + name + '-src.bip')) dst = Adapter.adapt_schema(src, schema) tmp = pybut.dbname() fd = open(tmp, 'w') dst.xmlwrite(fd) fd.close() pybut.fileeq(pybut.src('ut_adapter/' + name + '-dst.bip'), tmp) def testWOK2BibTeX(self): self.check('wok-to-bibtex', 'org.pybliographer/bibtex/0.1') suite = pybut.suite(TestFromAtoB, TestResolution) if __name__ == '__main__': pybut.run (suite)
class TestSimpleQueryFile(TestSimpleQuery, pybut.TestCase): fmt = "file" class TestSimpleQueryFileIndexed(TestSimpleQuery, pybut.TestCase): fmt = "file" indexed = True class TestSimpleQueryDB(TestSimpleQuery, pybut.TestCase): fmt = "bsddb" files = [TestSimpleQueryFile, TestSimpleQueryFileIndexed] bsddb = [TestSimpleQueryDB] # in some cases, we cannot check for bsddb (too old) try: m = Store.get("bsddb") suite = pybut.suite(*(files + bsddb)) except ImportError, msg: print "warning: only testing the file store: %s" % msg suite = pybut.suite(*files) if __name__ == "__main__": pybut.run(suite)