summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apscheduler/util.py2
-rw-r--r--tests/test_util.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/apscheduler/util.py b/apscheduler/util.py
index 1e643bf..196b81d 100644
--- a/apscheduler/util.py
+++ b/apscheduler/util.py
@@ -92,7 +92,7 @@ def astimezone(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.zone == 'local':
+ if obj.tzname(None) == 'local':
raise ValueError(
'Unable to determine the name of the local timezone -- you must explicitly '
'specify the name of the local timezone. Please refrain from using timezones like '
diff --git a/tests/test_util.py b/tests/test_util.py
index 7cadbc2..ab10f50 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -98,7 +98,7 @@ class TestAstimezone(object):
assert 'Only timezones from the pytz library are supported' in str(exc.value)
def test_bad_local_timezone(self):
- zone = Mock(tzinfo, localize=None, normalize=None, zone='local')
+ zone = Mock(tzinfo, localize=None, normalize=None, tzname=lambda dt: 'local')
exc = pytest.raises(ValueError, astimezone, zone)
assert 'Unable to determine the name of the local timezone' in str(exc.value)