more test cleanup

pull/1398/head
Chris Caron 2025-08-23 13:25:12 -04:00
parent 638cec15d9
commit 1c7b4e0655
4 changed files with 16 additions and 5 deletions

View File

@ -31,6 +31,7 @@ from datetime import tzinfo
from functools import partial
import re
from typing import Any, ClassVar, Optional, TypedDict, Union
from zoneinfo import ZoneInfo
from ..apprise_attachment import AppriseAttachment
from ..common import (
@ -875,8 +876,8 @@ class NotifyBase(URLBase):
"overflow": self.overflow_mode.value,
}
# Timezone Information
if self.__tzinfo:
# Timezone Information (if ZoneInfo)
if self.__tzinfo and isinstance(self.__tzinfo, ZoneInfo):
params["tz"] = self.__tzinfo.key
# Persistent Storage Setting

View File

@ -25,6 +25,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import contextlib
from datetime import timezone as _tz
from typing import Optional
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
@ -40,9 +41,14 @@ def zoneinfo(name: str) -> Optional[ZoneInfo]:
if not isinstance(name, str):
return None
# Normalise common UTC spellings
if name.lower() in {"utc", "z", "gmt"}:
name = "UTC"
raw = name.strip()
if not raw:
return None
# Windows-safe: accept UTC family even without tzdata
if raw.lower() in {
"utc", "z", "gmt", "etc/utc", "etc/gmt", "gmt0", "utc0"}:
return _tz.utc
# Try exact match first
try:

View File

@ -45,6 +45,8 @@ dependencies = [
"PyYAML",
# Root certificate authority bundle
"certifi",
# Always ship IANA tzdb on Windows so ZoneInfo works
"tzdata; platform_system == 'Windows'",
]
# Identifies all of the supported plugins
@ -220,6 +222,7 @@ all-plugins = [
]
windows = [
"pywin32",
"tzdata",
]
[project.urls]

View File

@ -4,3 +4,4 @@
# occur in pyproject.toml. Contents of this file can be found
# in [project.optional-dependencies].windows
pywin32
tzdata