summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2011-05-29 16:45:42 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2011-05-29 16:45:42 +0300
commita65bd0e64be33c09c82efb7be3128cbdd581c0cd (patch)
tree69b1f14584ce62defd6b7da843eaf73f533da012
parent64824d99f10bf729a77c7df193b3f436524ae90f (diff)
downloadapscheduler-a65bd0e64be33c09c82efb7be3128cbdd581c0cd.tar.gz
Added unit test for scheduling bound methods
-rw-r--r--tests/testscheduler.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testscheduler.py b/tests/testscheduler.py
index 30f1a94..d4785c9 100644
--- a/tests/testscheduler.py
+++ b/tests/testscheduler.py
@@ -160,6 +160,21 @@ class TestJobExecution(object):
self.scheduler._process_jobs(job.next_run_time)
eq_(a.val, 2)
+ def test_schedule_method(self):
+ # Tests that bound methods can be scheduled (at least with RAMJobStore)
+ class A:
+ def __init__(self):
+ self.val = 0
+ def method(self):
+ self.val += 1
+
+ a = A()
+ job = self.scheduler.add_interval_job(a.method, seconds=1)
+ self.scheduler._process_jobs(job.next_run_time)
+ self.scheduler._process_jobs(job.next_run_time)
+ eq_(a.val, 2)
+
+
def test_unschedule_job(self):
def increment():
vals[0] += 1