← Back to team overview

sikuli-driver team mailing list archive

[Question #188776]: Can't keep error handler from running

 

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

Here is what I have....
.
.
.
.
def weatherAlertHandler(event): 
    if exists(WeatherAlertNoBtn):
       click(getLastMatch())
    else:
       print("In weatherAlertHandler")
       assert exists(WeatherAlertNoBtn)     
        
class  SeaTowTests(unittest.TestCase):
    

    def setUp(self):
        print("setting things up")
        SeaTowArea = getRegionFromPSRM(find(SeaTowSim))
        setROI(SeaTowArea)
        SeaTowArea.highlight(3)
        SeaTowArea.observe(FOREVER)
        SeaTowArea.onAppear(WeatherAlert, weatherAlertHandler(WeatherAlert)) 
     def test.....

     a bunch of tests...

     def tearDown(self):
        print("tearing things down")
        if exists(BackDayBtn):
            click(getLastMatch())
        elif exists(BackNightBtn):
            click(getLastMatch())
        SeaTowArea.stopObserver()

When I run this every test hits the weatherAlertHandler code and does a "assert". 

"....Traceback (most recent call last):
  File "/var/folders/WF/WFrwRAbwE1GZJocb0i2G9U+++TI/-Tmp-/sikuli-tmp2723127438187617593.py", line 88, in setUp
    SeaTowArea.onAppear(WeatherAlert, weatherAlertHandler(WeatherAlert))
  File "/var/folders/WF/WFrwRAbwE1GZJocb0i2G9U+++TI/-Tmp-/sikuli-tmp2723127438187617593.py", line 77, in weatherAlertHandler
    assert exists(WeatherAlertNoBtn)
AssertionError "....


What am I doing wrong? The "WeatherAlert" image is definitely not on the emulator screen. I've also tried moving the "observe" command below the "onAppear" call. 


   

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