← Back to team overview

sikuli-driver team mailing list archive

[Question #188042]: Using common functions across scripts

 

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

I’ve been trying to get on top of this for the day, I’ve tried all suggestions in previous posts, read the python docs and read the sikuli docs but I’m not getting anywhere.  Newbie programmer so this probably doesn’t help.

I want to be able to call common functions from script to script.  An example of this would be to have a common setUp() and tearDown() along with other functions which are re-used in all of my scripts.  In each new script to reduce code length is it possible to just call another function in a script or for the class to inherit methods from another class?

I currently have something like this:  It runs but does nothing, no errors so I’m not sure what to do.

Function.sikuli

class super_awesome_parent_class(unittest.TestCase):
        def setUp(self):
                #do Lots of awesome stuff
                #that you always want done
       
        def tearDown(self):
                #tear stuff down

NewTestScript.sikuli

>From sikuli import*
>From function import*

class SomeTests (super_awesome_parent_class):

	def testOne(self):
		pass

	def testTwo(self):
		pass




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