diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-02-27 17:42:18 +0200 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-02-27 17:44:04 +0200 |
commit | a5e2cadb8a60ded5b57169e0c080782e976dc99b (patch) | |
tree | 4f0f3a6b8a7734e18086e7754eeb5d026b78b9e0 | |
parent | f126487097b0ccb234e0c11e72a397716f3578d3 (diff) | |
download | apscheduler-a5e2cadb8a60ded5b57169e0c080782e976dc99b.tar.gz |
Removed a leftover check for pytz timezones3.9.1
Fixes #599.
-rw-r--r-- | apscheduler/util.py | 2 | ||||
-rw-r--r-- | docs/migration.rst | 1 | ||||
-rw-r--r-- | docs/versionhistory.rst | 6 | ||||
-rw-r--r-- | tests/test_util.py | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/apscheduler/util.py b/apscheduler/util.py index 6f70f92..d929a48 100644 --- a/apscheduler/util.py +++ b/apscheduler/util.py @@ -90,8 +90,6 @@ def astimezone(obj): if isinstance(obj, six.string_types): return timezone(obj) if isinstance(obj, tzinfo): - if not hasattr(obj, 'localize') or not hasattr(obj, 'normalize'): - raise TypeError('Only timezones from the pytz library are supported') if obj.tzname(None) == 'local': raise ValueError( 'Unable to determine the name of the local timezone -- you must explicitly ' diff --git a/docs/migration.rst b/docs/migration.rst index 72c07fd..8dc1748 100644 --- a/docs/migration.rst +++ b/docs/migration.rst @@ -68,6 +68,7 @@ but if you were instantiating triggers manually before, then one must be supplie The only other backwards incompatible change was that ``get_next_fire_time()`` takes two arguments now: the previous fire time and the current datetime. +.. note:: APScheduler 3.9.0 added experimental support for non-pytz timezones. From v1.x to 2.0 ================ diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index 2dffb24..55490fc 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -4,6 +4,12 @@ Version history To find out how to migrate your application from a previous version of APScheduler, see the :doc:`migration section <migration>`. +3.9.1 +----- + +* Removed a leftover check for pytz ``localize()`` and ``normalize()`` methods + + 3.9.0 ----- diff --git a/tests/test_util.py b/tests/test_util.py index f7f900b..64ad233 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -94,8 +94,8 @@ class TestAstimezone(object): assert astimezone(None) is None def test_bad_timezone_type(self): - exc = pytest.raises(TypeError, astimezone, tzinfo()) - assert 'Only timezones from the pytz library are supported' in str(exc.value) + pytest.raises(NotImplementedError, astimezone, tzinfo()).\ + match(r'(a )?tzinfo subclass must (implement|override) tzname\(\)') def test_bad_local_timezone(self): zone = Mock(tzinfo, localize=None, normalize=None, tzname=lambda dt: 'local') |