Skip to content

Commit

Permalink
Merge branch 'master' into 846-subscribe-static-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm authored Apr 25, 2024
2 parents 50031f0 + b5dfbed commit 9207f3e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ APScheduler, see the :doc:`migration section <migration>`.
- Fixed JSON serialization of triggers that had been used at least once
- Fixed dialect name checks in the SQLAlchemy job store
- Fixed JSON and CBOR serializers unable to serialize enums
- Fixed infinite loop in CalendarIntervalTrigger with UTC timezone (PR by unights)

**4.0.0a4**

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cbor = ["cbor2 >= 5.0"]
mongodb = ["pymongo >= 4"]
mqtt = ["paho-mqtt >= 2.0"]
redis = ["redis >= 4.4.0"]
sqlalchemy = ["sqlalchemy >= 2.0.19"]
sqlalchemy = ["sqlalchemy[asyncio] >= 2.0.19"]
test = [
"APScheduler[cbor,mongodb,mqtt,redis,sqlalchemy]",
"asyncpg >= 0.20; python_implementation == 'CPython'",
Expand Down
2 changes: 1 addition & 1 deletion src/apscheduler/triggers/calendarinterval.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def next(self) -> datetime | None:
next_time = datetime.fromtimestamp(timestamp, self.timezone)

# Check if the time is off due to normalization and a forward DST shift
if next_time.time() != self._time:
if next_time.timetz() != self._time:
previous_date = next_time.date()
else:
self._last_fire_date = next_date
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def timezone() -> ZoneInfo:
return ZoneInfo("Europe/Berlin")


@pytest.fixture(scope="session")
def utc_timezone() -> ZoneInfo:
return ZoneInfo("UTC")


@pytest.fixture(
params=[
pytest.param(PickleSerializer, id="pickle"),
Expand Down
7 changes: 7 additions & 0 deletions tests/triggers/test_calendarinterval.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,10 @@ def test_repr(timezone, serializer):
"time='03:00:08', start_date='2016-03-05', end_date='2020-12-25', "
"timezone='Europe/Berlin')"
)


def test_utc_timezone(utc_timezone):
trigger = CalendarIntervalTrigger(
days=1, hour=1, start_date=date(2016, 3, 31), timezone=utc_timezone
)
assert trigger.next() == datetime(2016, 3, 31, 1, tzinfo=utc_timezone)

0 comments on commit 9207f3e

Please sign in to comment.