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 from functools import partial
import re import re
from typing import Any, ClassVar, Optional, TypedDict, Union from typing import Any, ClassVar, Optional, TypedDict, Union
from zoneinfo import ZoneInfo
from ..apprise_attachment import AppriseAttachment from ..apprise_attachment import AppriseAttachment
from ..common import ( from ..common import (
@ -875,8 +876,8 @@ class NotifyBase(URLBase):
"overflow": self.overflow_mode.value, "overflow": self.overflow_mode.value,
} }
# Timezone Information # Timezone Information (if ZoneInfo)
if self.__tzinfo: if self.__tzinfo and isinstance(self.__tzinfo, ZoneInfo):
params["tz"] = self.__tzinfo.key params["tz"] = self.__tzinfo.key
# Persistent Storage Setting # 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 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
import contextlib import contextlib
from datetime import timezone as _tz
from typing import Optional from typing import Optional
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
@ -40,9 +41,14 @@ def zoneinfo(name: str) -> Optional[ZoneInfo]:
if not isinstance(name, str): if not isinstance(name, str):
return None return None
# Normalise common UTC spellings raw = name.strip()
if name.lower() in {"utc", "z", "gmt"}: if not raw:
name = "UTC" 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 exact match first
try: try:

View File

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

View File

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