← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #189457]: Importing library but wont run [Unit Test Mode]

 

Question #189457 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/189457

Description changed to:
I am having issues with importing other Sikuli scripts that I made so I
can reuse code.

I am trying to import my library and use them in the Unit Test mode.

I have followed Question #146640 (https://answers.launchpad.net/sikuli/+question/146640)
and also the documentations on importing other Sikuli Scripts from the Sikuli site. (http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images)

But some reason it does seem to work for me.

I am running Sikuli X-1.0rc3 (r905)
Windows Environment


Example of how my code looks out BUT not the exact code.

My Library File Located in C:\Lib

MyLib.Sikuli
--------------
from sikuli import *

def PrintMe():
    print "I worked"


SampleUnitTest.Sikuli
---------------
def setUp(self):
    Libs = "C:\\Lib"
    if not Libs in sys.path: sys.path.append(Libs)
    import MyLib

def tearDown(self):
    sleep(1)

def test_ATest(self):
    print "Before"
    Libs.PrintMe()
    print "After”


When I run the Unit Test, I see "Before" printed out but NOT "I worked" or "After".

I have also tested "self.Libs.PrintMe()", "MyLib.PrintMe()", and
"self.MyLib.PrintMe()" but did not help at all.

Also for my future reference...
IF my question is considered to be related to another ticket that is labeled solved/closed like the ticket that I referenced at top for this question... Should I post in that thread even if its been solved/closed? AND if that post was very old, will my post get recognized??? or should I make a new post like I did just now???

Thanks

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