sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #21528
Re: [Question #236945]: How to terminate a unittest on failure and move to following unittests
Question #236945 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/236945
Status: Open => Answered
RaiMan proposed the following answer:
if you want to skip something depending on a switch, you have to
possibilities:
--- version 1 (using if/while/ ...)
# some preps here
# including setting the global switch to true (means should run)
... some code independent of switch
if switch:
# some code to be executed as long as switch is false
... some code independent of switch
if switch:
# some code to be executed as long as switch is false
... and more of these
If the switch is set to false from somewhere else, the respective code
snippets will be skipped
--- version 2 (using a simple thread)
def workload():
# here goes all the stuff that should be run as test
# ...
# telling main we terminated successfully
global running
running = false
return # this ends the thread
switch = true
running = true
sub = thread.start_new_thread(workload, )
# we wait until either running or switch is set to false
while switch and running:
wait(1)
if running:
sub.exit() # terminate the thread if it is still running
... more info http://docs.python.org/2/library/thread.html
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.