def load_state(cls, file_name="default"): Room.clear() path = "db/" file_ = file_name + ".db" engine = create_engine("sqlite:///" + path + file_, echo=False) Session = sessionmaker(bind=engine) session = Session() allocation_info = session.query(Allocation).all() for allocation_ in allocation_info: allocation = [ allocation_.roomname, allocation_.roomtype, allocation_.phonenumber ] allocation_str = "%s-%s-%s" % (allocation_.roomname, allocation_.roomtype, allocation_.phonenumber) allocation_name_type_str = "%s-%s" % (allocation_.roomname, allocation_.roomtype) allocations.append(allocation) allocations_name_type.append(allocation_name_type_str) allocations_set.add(allocation_str) session.close()
def clear_stores(self): #Clean data stores to run print tests Dojo.clear() Room.clear() Person.clear()