Fix None check in JobQueue._put() (#1707)

fixes #1701
This commit is contained in:
Bibo-Joshi 2020-01-26 22:07:17 +01:00 committed by Noam Meltzer
parent fbb7e0e645
commit cb9af36937
2 changed files with 7 additions and 1 deletions

View file

@ -95,7 +95,8 @@ class JobQueue(object):
"""
# get time at which to run:
time_spec = time_spec or job.interval
if time_spec is None:
time_spec = job.interval
if time_spec is None:
raise ValueError("no time specification given for scheduling non-repeating job")
next_t = to_float_timestamp(time_spec, reference_timestamp=previous_t)

View file

@ -119,6 +119,11 @@ class TestJobQueue(object):
sleep(0.07)
assert self.result == 1
def test_run_repeating_first_immediate(self, job_queue):
job_queue.run_repeating(self.job_run_once, 0.1, first=0)
sleep(0.05)
assert self.result == 1
def test_run_repeating_first_timezone(self, job_queue, timezone):
"""Test correct scheduling of job when passing a timezone-aware datetime as ``first``"""
first = (dtm.datetime.utcnow() + timezone.utcoffset(None)).replace(tzinfo=timezone)