Beispiel #1
0
def create_new_db():
    # Drop old database, then make a new one.
    print('Clearing current database...')
    database.reflect()
    database.drop_all()
    print('Creating new database...')
    database.create_all()
    database.session.commit()
    print("Database created.")

    print("Loading data from JSON...")
Beispiel #2
0
def app(request):
    app = create_app(TestConfig)
    app.app_context().push()

    # def teardown():
    #     app.app_context().pop()

    # request.addfinalizer(teardown)
    # return app
    with app.app_context():
        # alternative pattern to app.app_context().push()
        # all commands indented under 'with' are run in the app context
        database.create_all()
        yield app  # Note that we changed return for yield, see below for why
        database.session.remove(
        )  # looks like db.session.close() would work as well
        database.drop_all()
 def tearDown(self):
     database.session.remove()
     database.drop_all()
     self.app_context.pop()
Beispiel #4
0
	def tearDown(self):
		database.drop_all()
		self.logout()
Beispiel #5
0
 def tearDown(self):
     database.drop_all()
     self.logout()
def reset():
    database.drop_all()
    database.create_all()
    importData()
Beispiel #7
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Beispiel #8
0
 def tearDown(self):
     database.session.remove()
     database.drop_all()
Beispiel #9
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
     for table in db.engine.table_names():
         db.engine.execute('DROP TABLE "{0}"'.format(table))
Beispiel #10
0
 def setUp(self):
     database.session.close()
     database.drop_all()
     database.create_all()
Beispiel #11
0
 def tearDown(self):
     database.session.close()
     database.drop_all()