← Back to team overview

sikuli-driver team mailing list archive

[Question #140658]: must import for each unittest test case

 

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

Experimenting with running Unittests with Sikuli X:

/Applications/Sikuli-IDE.app/sikuli-ide.sh -t /Users/janetPCF/Sikuli-testing/Miro/test.sikuli

if I have my tests setup like this:

#test.sikuli

import os   
def setUp(self): 
    myApp = "/Applications/Miro.app"
    App.open(myApp)
    print os.getenv("SIKULI_TEST_HOME")  # an env variable set on my system
  
def tearDown(self):
    print "my test is done"
    
def test_mytest(self):
    wait("MiroFileEdit.png")
    click("Sidebar")

The test will fail - with global os not found.  In order for os.getenv - to work, I must import it in setup - or any other testcase where I would want to use it.

I expect to need various python and custom modules in my tests, and don't want to have to make the imports for each individual test case.

When I was using 10.2 - things were working as expected.  Here's an example: https://github.com/PCF-qa/MVC/blob/master/sg59_apple_devs.sikuli/sg59_apple_devs.py

these tests I was running using this command: java -d32 -Dpython.path=Lib/ -jar sikuli-script.jar MVC/sg59_apple_devs.sikuli

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