Пример #1
0
            
    def datatest2():
        i = 'potty/'+str(os.urandom(10)).replace('/','|')
        def recive(x,y):
            tester[x] = y
        
        subscribe('potty/',recive)
        x =str(os.urandom(100))
        postMessage(i,x)
        time.sleep((random.random()/100)+0.05)
        if not tester[i] == x:
            fail('Message not properly recieved.')
        else:
            #print("hooray")
            pass
    
    for i in range(0,1):
        for i in range(0,100):
            t = threading.Thread(target=dostuff)
            t.start()
            t = threading.Thread(target=datatest)
            t.start()
            t = threading.Thread(target=datatest2)
            t.start()
            time.sleep(0.05)    
   
if len(messagebus._bus.subscribers) > 5:
    fail('It appears that there are old subscriptions in the list for deleted callbacks. Memory Leak!')
    
suceed("Sucess in testing Message Bus system")
Пример #2
0
        setup='kaithem.globals.x = 0',
        priority = 1,
        ratelimit = 0
        )
    
except BSException:
    pass

    
#Now let's delete the WHOLE MODULE the event is in
try:
    wb.deletemoduletarget(name='TEST')
except BSException:
    pass

#And make sure it is really gone
kaithem.globals.x = 17
time.sleep(0.25)
if not kaithem.globals.x == 17:
    common.fail("Deleting event did not remove its effects.")

#Make sure the module is really gone from the index
if 'TEST' in wb.index():
    common.fail("Deleted module, but it was still in the index.")
######################################################################################




common.suceed("Sucess in testing modules system")
Пример #3
0
        def recive(x, y):
            tester[x] = y

        subscribe('potty/', recive)
        x = str(os.urandom(100))
        postMessage(i, x)
        time.sleep((random.random() / 100) + 0.05)
        if not tester[i] == x:
            fail('Message not properly recieved.')
        else:
            #print("hooray")
            pass

    for i in range(0, 1):
        for i in range(0, 100):
            t = threading.Thread(target=dostuff)
            t.start()
            t = threading.Thread(target=datatest)
            t.start()
            t = threading.Thread(target=datatest2)
            t.start()
            time.sleep(0.05)


if len(messagebus._bus.subscribers) > 5:
    fail(
        'It appears that there are old subscriptions in the list for deleted callbacks. Memory Leak!'
    )

suceed("Sucess in testing Message Bus system")
    
if not unitsofmeasure.strToIntWithSIMultipliers('10k') ==10000:
    common.fail()

x = unitsofmeasure.DayOfWeek("Tuesday")
if not x == 1:
    common.fail()
    
if not x == 'tue':
    common.fail()
    
if not x == 'Tuesday':
    common.fail()
    
if  x == 'Monday':
    common.fail()

if not x == unitsofmeasure.DayOfWeek("Tuesday"):
    common.fail()
    
x = unitsofmeasure.Month("May")

if not x == 5:
    common.fail()
    
if not x == unitsofmeasure.Month(5):
    common.fail()
    
common.suceed("Success testing unitsofmeasure.py")
    
    common.fail()

if not unitsofmeasure.strToIntWithSIMultipliers('10k') == 10000:
    common.fail()

x = unitsofmeasure.DayOfWeek("Tuesday")
if not x == 1:
    common.fail()

if not x == 'tue':
    common.fail()

if not x == 'Tuesday':
    common.fail()

if x == 'Monday':
    common.fail()

if not x == unitsofmeasure.DayOfWeek("Tuesday"):
    common.fail()

x = unitsofmeasure.Month("May")

if not x == 5:
    common.fail()

if not x == unitsofmeasure.Month(5):
    common.fail()

common.suceed("Success testing unitsofmeasure.py")