예제 #1
0
파일: test_mydb.py 프로젝트: Ar-sayyad/demo
def cur():
    print("Setting Up")
    db = MyDB()
    conn = db.connect("server")
    curs = conn.cursor()
    yield curs
    curs.close()
    conn.close()
    print("Closing DB")
예제 #2
0
def cur():
    db = MyDB()
    conn = db.connect("server")
    curs = conn.cursor()
    # return curs # asi se crea uno por test
    yield curs # asi se crea una sola vez
    curs.close() # va con el yield
    conn.close() # va con el yield
    print("teardown")
예제 #3
0
def cur():
    print("setting up")
    db = MyDB()
    conn = db.connect("server")
    curs = conn.cursor()
    yield curs
    curs.close()
    conn.close()
    print("closing connection")
예제 #4
0
def cur():
    print("setting up")
    db = MyDB()
    conn = db.connect("server")
    cur = conn.cursor()
    # yield cursor so can run the close op later
    yield cur
    cur.close()
    conn.close()
    print("close DB")
def cur():
    print("\n-----------------setting DB-------------------")
    db = MyDB()
    conn = db.connect("server")
    curs = conn.cursor()
    yield curs  # yields iterative
    # Return sends a specified value back to its caller
    # whereas Yield can produce a sequence of values.
    curs.close()
    conn.close()
    print("\n---------------------closing DB--------------------")
예제 #6
0
def setup_module(module):
    global conn, cur
    db = MyDB()
    conn = db.connect("server")
    cur = conn.cursor()