Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Apr 19, 2021
1 parent 127c500 commit 0e25d90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def cmp_local(obj: Union[float, int, dt_datetime], local_dt: dt_datetime):
cmp_dt = instance(obj, local_tz).astimezone(local_tz).naive()
else:
cmp_dt = from_timestamp(obj, tz=local_tz).naive()
assert cmp_dt == local_dt, f'{cmp_dt}\n{local_dt}'
assert cmp_dt == local_dt, f'\n{cmp_dt}\n{local_dt}'


def cmp_utc(obj: Union[float, int, dt_datetime], local_dt: dt_datetime):
Expand All @@ -54,4 +54,4 @@ def cmp_utc(obj: Union[float, int, dt_datetime], local_dt: dt_datetime):
cmp_dt = instance(obj, local_tz).astimezone(local_tz).in_tz(UTC).naive()
else:
cmp_dt = from_timestamp(obj, tz=UTC).naive()
assert cmp_dt == local_dt, f'{cmp_dt}\n{local_dt}'
assert cmp_dt == local_dt, f'\n{cmp_dt}\n{local_dt}'
12 changes: 7 additions & 5 deletions tests/jobs/test_job_onetime.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import asyncio
from datetime import datetime

import pytest

from eascheduler.const import SKIP_EXECUTION
from eascheduler.errors import JobAlreadyCanceledException, OneTimeJobCanNotBeSkipped
from eascheduler.jobs.job_one_time import OneTimeJob
from eascheduler.schedulers import AsyncScheduler
from tests.helper import cmp_local, utc_ts
from tests.helper import mocked_executor, set_now
from tests.helper import utc_ts


def test_exception():
Expand Down Expand Up @@ -55,12 +56,13 @@ async def test_init():

j._initialize_base_time(None)
j._update_run_time()
assert int(j._next_base) == 978346800
assert int(j._next_run) == 978346800

cmp_local(j._next_base, datetime(2001, 1, 1, 12, 0, 0, 1))
cmp_local(j._next_run, datetime(2001, 1, 1, 12, 0, 0))

j._initialize_base_time(3)
j._update_run_time()
assert int(j._next_base) == 978346803
assert int(j._next_run) == 978346803
cmp_local(j._next_base, datetime(2001, 1, 1, 12, 0, 3))
cmp_local(j._next_run, datetime(2001, 1, 1, 12, 0, 3))

j.cancel()

0 comments on commit 0e25d90

Please sign in to comment.