def setup_module(self): """ Setup data that will be needed throughout the class and setup database """ self.config = testing.setUp() engine = create_engine("sqlite:///testdb.sqlite") DBSession.configure(bind=engine) Base.metadata.create_all(engine)
def setup_class(self): """ This method sets up the class for testing, storing shared that data that will be used in multiple tests. """ self.config = testing.setUp() engine = create_engine('sqlite:///testdb.sqlite') DBSession.configure(bind=engine) Base.metadata.create_all(engine)
def setup_class(self): ''' Setup data that will be needed throughout the class and setup database ''' self._insert_name = str(time.time()) self.config = testing.setUp() engine = create_engine('sqlite:///testdb.sqlite') DBSession.configure(bind=engine) Base.metadata.create_all(engine)
def setup_class(self): """ This method sets up the testing class, initialising shared data that will be needed during testing. """ self._insert_name = str(time.time()) self.config = testing.setUp() engine = create_engine('sqlite:///testdb.sqlite') DBSession.configure(bind=engine) Base.metadata.bind = engine Base.metadata.create_all(engine)
def main(argv=sys.argv): """ Initialise the database if this module is called from the command line or external software. @param argv The system arguments from the command line or external software. """ if len(argv) < 2: usage(argv) config_uri = argv[1] options = parse_vars(argv[2:]) setup_logging(config_uri) settings = get_appsettings(config_uri, options=options) engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: pass