def load_schema(path): path = path.replace(".", os.sep) + ".yml" meta = yaml_load(open(path)) if "$schema" in meta: schema = yaml_load(open(meta["$schema"])) jsonschema.validate(meta, schema) else: print >> sys.stderr, "No validation for", path # schema = extract_schema(meta) return list(extract_orm(meta))
from sqlalchemy.ext.declarative import declarative_base from confparse import yaml_load from taxus.init import extract_orm, get_session from taxus.util import ORMMixin def load_schema(path): path = path.replace('.', os.sep)+'.yml' try: meta = yaml_load(open(path)) except Exception, e: print e raise Exception("Error loading %s from %s" % (path, os.getcwd()), e) #schema = extract_schema(meta) return list(extract_orm(meta)) class TestTaxusSchema(unittest.TestCase): prefix = '/tmp/' schema = None models = [ ] fields = {} def setUp(self): self.pwd = os.getcwd() def test_taxus_schema_basic_load(self): if not self.schema: return