def setup(self): if os.path.exists(path.join('test_output', 'gh.sqlite')): os.unlink(path.join('test_output', 'gh.sqlite')) if metadata.bind: metadata.drop_all() # The SQLA tables notes = Table('notes', metadata, Column('id', types.Integer, primary_key=True), Column('title', types.Text), Column('note', types.Text), Column('importance', types.Text), useexisting=True, ) # The ORM mapped class class Note(object): """ Represents a note """ self.Note = Note # Make a mapper which gives you the objects manager mapper(Note, notes) def setup_app(app): app.add_setup(setup_sqlalchdb, 'sqlite://') self._setup_app = setup_app refresh_engine() self.app = make_app(setup_app, 'test_output') self.c = Client(self.app)
def setup(self): """Creates a test environment.""" if os.path.exists(path.join('test_output', 'gh.sqlite')): os.unlink(path.join('test_output', 'gh.sqlite')); with open(path.join('test_output', 'config.ini'), 'w') as file: file.write(SQLA_TRACK_CONFIG) refresh_engine() self.app = make_app(self.setup_app, 'test_output') data_init() # Bind the model to the new engine Author.metadata.bind = get_engine()