def test_jobs_equal(self): assert self.job == self.job job2 = Job(SimpleTrigger(self.RUNTIME), lambda: None, [], {}, 1, False) assert self.job != job2 job2.id = self.job.id = 123 eq_(self.job, job2) assert self.job != 'bleh'
def test_setstate(self): trigger = SimpleTrigger('2010-12-14 13:05:00') state = dict(trigger=trigger, name='testjob.dummyfunc', func_ref='testjob:dummyfunc', args=[], kwargs={}, misfire_grace_time=2, max_runs=2, coalesce=True, max_instances=2, runs=1) self.job.__setstate__(state) eq_(self.job.trigger, trigger) eq_(self.job.func, dummyfunc) eq_(self.job.max_runs, 2) eq_(self.job.coalesce, True) eq_(self.job.max_instances, 2) eq_(self.job.runs, 1) assert not hasattr(self.job, 'func_ref') assert isinstance(self.job._lock, lock_type)
def setup(self): self.trigger = SimpleTrigger(self.RUNTIME) self.job = Job(self.trigger, dummyfunc, [], {}, 1, False)
def test_create_job_invalid_maxinstances(): Job(SimpleTrigger(datetime.now()), lambda: None, [], {}, 1, False, max_instances=0)
def test_create_job_invalid_misfire(): Job(SimpleTrigger(datetime.now()), lambda: None, [], {}, 0, False)
def test_create_job_invalid_kwargs(): Job(SimpleTrigger(datetime.now()), lambda: None, [], None, 1, False)
def test_create_job_invalid_func(): Job(SimpleTrigger(datetime.now()), 'bleh', [], {}, 1, False)