override method sleep

Asked by Chetan

Hi
we have our own method waittime similar to sleep and would like users to use that in framework and not sleep
is there a way we can show a message/ print a message whenever sleep is called or overide the sleep method and call our own method?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

yes, possible:

- make a script, that contains your sleep def: (myoverrides.py)
def sleep(time):
     print "mysleep variant"

- in the script to use your sleep:
if not somepath in sys.path:
    sys.path.insert(0, somepath)
from myoverrides import *
sleep(10)

... should print
mysleep variant

.. where homepath is the folder, that contains the myoverrides.py

Revision history for this message
Chetan (cshamdas) said :
#2

Thanks RaiMan, that solved my question.