diff options
Diffstat (limited to 'paste/webkit/FakeWebware/TaskKit/Tests')
-rw-r--r-- | paste/webkit/FakeWebware/TaskKit/Tests/BasicTest.py | 58 | ||||
-rw-r--r-- | paste/webkit/FakeWebware/TaskKit/Tests/Test.py | 30 | ||||
-rw-r--r-- | paste/webkit/FakeWebware/TaskKit/Tests/__init__.py | 1 |
3 files changed, 0 insertions, 89 deletions
diff --git a/paste/webkit/FakeWebware/TaskKit/Tests/BasicTest.py b/paste/webkit/FakeWebware/TaskKit/Tests/BasicTest.py deleted file mode 100644 index 235be23..0000000 --- a/paste/webkit/FakeWebware/TaskKit/Tests/BasicTest.py +++ /dev/null @@ -1,58 +0,0 @@ -import os, sys -sys.path.insert(1, os.path.abspath('../..')) -import TaskKit - -from TaskKit.Scheduler import Scheduler -from TaskKit.Task import Task -from time import time, sleep - - -class SimpleTask(Task): - - def run(self): - if self.proceed(): - print self.name(), time() -## print "Increasing period" -## self.handle().setPeriod(self.handle().period()+2) - else: - print "Should not proceed", self.name() - print "proceed for %s=%s, isRunning=%s" % (self.name(), self.proceed(), self._handle._isRunning) - - -class LongTask(Task): - def run(self): - while 1: - sleep(2) - print "proceed for %s=%s, isRunning=%s" % (self.name(), self.proceed(), self._handle._isRunning) - if self.proceed(): - print ">>",self.name(), time() - else: - print "Should not proceed:", self.name() - return - -def main(): - from time import localtime - scheduler = Scheduler() - scheduler.start() - scheduler.addPeriodicAction(time(), 1, SimpleTask(), 'SimpleTask1') - scheduler.addTimedAction(time()+3, SimpleTask(), 'SimpleTask2') - scheduler.addActionOnDemand(LongTask(), 'LongTask') - scheduler.addDailyAction(localtime(time())[3], localtime(time())[4]+1, SimpleTask(), "DailyTask") - sleep(5) - print "Demanding LongTask" - scheduler.runTaskNow('LongTask') - sleep(1) -# print "Stopping LongTask" -# scheduler.stopTask("LongTask") - sleep(2) -# print "Deleting 'SimpleTask1'" -# scheduler.unregisterTask("SimpleTask1") - sleep(4) - print "Calling stop" - scheduler.stop() -## sleep(2) - print "Test Complete" - - -if __name__=='__main__': - main() diff --git a/paste/webkit/FakeWebware/TaskKit/Tests/Test.py b/paste/webkit/FakeWebware/TaskKit/Tests/Test.py deleted file mode 100644 index b45d3f6..0000000 --- a/paste/webkit/FakeWebware/TaskKit/Tests/Test.py +++ /dev/null @@ -1,30 +0,0 @@ -import os, sys -sys.path.insert(1, os.path.abspath('../..')) -import TaskKit -#from MiscUtils import unittest -import unittest - - -class TaskKitTest(unittest.TestCase): - - def setUp(self): - from TaskKit.Scheduler import Scheduler - self.scheduler = Scheduler() - - def checkBasics(self): - sched = self.scheduler - sched.start() - - def tearDown(self): - self.scheduler.stop() - self.scheduler = None - - -def makeTestSuite(): - suite1 = unittest.makeSuite(TaskKitTest, 'check') - return unittest.TestSuite((suite1,)) - - -if __name__=='__main__': - runner = unittest.TextTestRunner(stream=sys.stdout) - unittest.main(defaultTest='makeTestSuite', testRunner=runner) diff --git a/paste/webkit/FakeWebware/TaskKit/Tests/__init__.py b/paste/webkit/FakeWebware/TaskKit/Tests/__init__.py deleted file mode 100644 index 792d600..0000000 --- a/paste/webkit/FakeWebware/TaskKit/Tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# |