def test_database_durability(self): conn = connect() cursor = conn.cursor() queryList = [ "SELECT * FROM mimiciii.ADMISSIONS WHERE subject_id = {}".format( rand.randint(10, 10000)) for i in range(10) ] lock = Lock() threadList = [None for i in range(10)] for i in range(len(threadList)): threadList[i] = Thread(target=execute_stmt, args=(cursor, queryList[rand.randint(0, 9)], lock)) threadList[i].start() for thread in threadList: thread.join() # If it makes it this far then all tests passed self.assertTrue(True)
from cli import Application from app import connect if __name__ == "__main__": #import sys #sys.path.append('/Applications/PyCharm.app/pycharm-debug.egg') #import pydevd #pydevd.settrace('localhost', port=9191, stdoutToServer=True, stderrToServer=True) connect() App = Application() try: App.run() except KeyboardInterrupt: pass
def test_database_connection(self): conn = connect() self.assertNotEqual(type(conn), None, 'Connection to database failed')
def test_connection(self, mockDB): valid_credential = config.credential app.connect(valid_credential) mockDB.assert_called_with(valid_credential)
def setup(app): '''Connect to setup-flask-app and modify-rest-api events''' app.connect("setup-flask-app", setup_flask_app) app.connect("modify-rest-api", modify_rest_api)
import app app.connect()