← Back to team overview

sikuli-driver team mailing list archive

[Question #212171]: tearDown not called when calling exit() in a unit test

 

New question #212171 on Sikuli:
https://answers.launchpad.net/sikuli/+question/212171

Hi,

I have a .sikuli unit test that looks like this:

def setUp(self):
    print "Setting up..."
    #some set-up code goes here

def tearDown(self):
    print "Tearing Down..."
    #some code for tearing down goes here

def testSomething(self):
    if not exists("SomeImage.png"):
        print "Verification failed for SomeImage"
        exit(1)

The issue with the code above is that the tearDown method is not executed when the verification fails and the "exit(1)" line is hit. If I comment-out the "exit(1)" line than the tearDown method is called as expected. 

Any hints about why tearDown is not called are highly appreciated :-)

I trued executing the test through both the Unit Test view in Sikuli IDE and through command-line with the same result. 
The version I'm using is Sikuli X-1.0rc3 (r905)

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