Have two files.
1 updatelib.py -- where function is defined. 2 test.py -- where I am calling function.
content of each file as follows:
CONTENT OF updatelib.py
import os, sys, re, time
import pexpect
def update(session):
try:
session.sendline("testapp")
time.sleep(5)
print "open test app"
session.expect_exact("Enter command")
time.sleep(5)
session.sendline("1")
time.sleep(5)
session.expect_exact("success")
print ("test is pass")
except:
print "Fail:("
CONTENT OF TEST.PY
import os, sys, re, time
import pexpect
import updatelib
updatelib.update(session)
time.sleep(120)
session.close()
QUESTION
It works perfectly fine when I call update(session) function within updatelib.py
But when I try to the call the same function from test.py, it prints "open test app" then goes into except and prints "Fail:("
Note: "testapp" is a utility that is available with 1-10 options
Any pointers to what am I missing here?
Aucun commentaire:
Enregistrer un commentaire