← Back to team overview

sikuli-driver team mailing list archive

[Question #149411]: Import sikuli from unit test

 

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

Hi!
I know this is a common subject on FAQ, but I cannot get this to work.
I have read through the following links (and more) thoroughly:
http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images
https://answers.launchpad.net/sikuli/+question/129031
https://answers.launchpad.net/sikuli/+question/127275
https://answers.launchpad.net/sikuli/+question/128341
https://answers.launchpad.net/sikuli/+question/146640
https://answers.launchpad.net/sikuli/+question/144555

I am trying to call an imported function from within a unit test. Is this possible?
My code looks like this:
Unit test
==========
myLib = "C:\\Users\\Lisa\\Documents\\Sikuli"
if not myLib in sys.path: sys.path.append(myLib)
import tools
from tools import *
def setUp(self):
        print "open"
def tearDown(self):
        print "close"
def testA(self):
        foobar()
        return True

Imported tool doc
================
from sikuli.Sikuli import *
def foobar():
   pass

I am not very familiar with unit testing or the usage of "self", so I have tried varied forms of this. Like, for instance, 
def testA(self):
        self.foobar()
        return True

I'm sorry to post yet another question on this subject, but I have honestly been trying everything I could think of, and I can not make this work.
Best regards

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