← Back to team overview

sikuli-driver team mailing list archive

[Question #688075]: ImagePath: find: not there when importing unittest TestCase into main script

 

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

I have a name.sikuli script which is as follows:

class TestA(unittest.TestCase):
    def testA(self):
        click("image.png")
        self.assertTrue(1 == 1)

When i run it with 

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestA)
    unittest.TextTestRunner(verbosity=2).run(suite)

it works fine.  Then I tried to create a main script and put name.sikuli into main.sikuli. Code of main.sikuli:

import os
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)

import name
reload(name)
from name import *

suite = unittest.TestLoader().loadTestsFromTestCase(TestA)
unittest.TextTestRunner(verbosity=2).run(suite)

When I tried to run main.sikuli it gave 

[error] ImagePath: find: not there: image.png

I tried to use functions from another script (which is not unittest class, just functions) in name.sikuli. The image from this script was found both times, when running name.sikuli and main.sikuli. Is there a problem when importing sikuli script that is a class?

P.S. using SikuliX IDE 2.0.0

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.