import sys, unittest, re, os.path, threading
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))

from Exscript.workqueue import MainLoop

class MainLoopTest(unittest.TestCase):
    CORRELATE = MainLoop

    def setUp(self):
        pass

    def testMainLoop(self):
        lock = threading.Lock()
        data = {'sum': 0, 'randsum': 0}
        ml   = MainLoop.MainLoop()
        nop  = lambda x: None

        for i in range(12345):
            ml.enqueue(nop, name = 'test', times = 1, data = None)

        self.assertEqual(0, data['sum'])

        # Note: Further testing is done in WorkQueueTest.py

def suite():
    return unittest.TestLoader().loadTestsFromTestCase(MainLoopTest)
if __name__ == '__main__':
    unittest.TextTestRunner(verbosity = 2).run(suite())

import sys, unittest, re, os.path, threading
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))

from Exscript.workqueue import MainLoop
from Exscript.workqueue.Job import ProcessJob

class MainLoopTest(unittest.TestCase):
    CORRELATE = MainLoop

    def setUp(self):
        pass

    def testMainLoop(self):
        lock = threading.Lock()
        data = {'sum': 0, 'randsum': 0}
        ml   = MainLoop.MainLoop(ProcessJob)
        nop  = lambda x: None

        for i in range(12345):
            ml.enqueue(nop, name = 'test', times = 1, data = None)

        self.assertEqual(0, data['sum'])

        # Note: Further testing is done in WorkQueueTest.py

def suite():
    return unittest.TestLoader().loadTestsFromTestCase(MainLoopTest)
if __name__ == '__main__':
    unittest.TextTestRunner(verbosity = 2).run(suite())

fix test for Exscript.workqueue.MainLoop.