← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #156247]: How are exception handled when using imported scripts?

 

Question #156247 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/156247

Tedi Roca gave more information on the question:
I did a simple test without using external libraries with the code you
proposed in another question, where I would expect test3 execution to be
handled as an exception but it is not. It does not seems to make a
difference using 'except' or 'except assertionError'.

Script:
---------
def test1():
	openApp ("Notepad.exe")
def test2():
	openApp ("Nothing.exe")
def test3():
 assert(False)

theTests = (test1, test2, test3)
theResults = []

for test in theTests:
 try:
  test()
  print test.__name__, "ok"
 except AssertionError:
  theResults.append(test.__name__)
  print test.__name__, "Failed"

print theResults

Result:
---------
[log] App.open Notepad.exe(348) 
test1 ok 
[log] App.open Nothing.exe(0) 
[error] App.open failed: Nothing.exe not found 
test2 ok 
test3 Failed 
['test3']

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.