Skip to content

Your lightweight open-source personal agent.

fix(config): install timezone data on all platforms

shixi-lidda9b61b1e75
diff --git a/pyproject.toml b/pyproject.toml
index a815f66af..d2be96b23 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -51,7 +51,7 @@ dependencies = [
"filelock>=3.25.2",
"watchfiles>=1.1.1,<2.0.0",
"packaging>=24.0",
- "tzdata>=2025.2; sys_platform == 'win32'",
+ "tzdata>=2025.2",
"defusedxml>=0.7.1,<1.0.0",
"pypdf>=5.0.0,<6.0.0",
"python-docx>=1.1.0,<2.0.0",
diff --git a/tests/channels/test_channel_plugins.py b/tests/channels/test_channel_plugins.py
index fb904be35..fea682081 100644
--- a/tests/channels/test_channel_plugins.py
+++ b/tests/channels/test_channel_plugins.py
@@ -2558,7 +2558,7 @@ def test_optional_dependency_metadata_for_enable():
):
assert not any(dep.startswith(dep_name) for dep in required)
for dependency in (
- "tzdata>=2025.2; sys_platform == 'win32'",
+ "tzdata>=2025.2",
"defusedxml>=0.7.1,<1.0.0",
"pypdf>=5.0.0,<6.0.0",
"python-docx>=1.1.0,<2.0.0",
diff --git a/tests/config/test_model_presets.py b/tests/config/test_model_presets.py
index 726a8f793..e419e40e8 100644
--- a/tests/config/test_model_presets.py
+++ b/tests/config/test_model_presets.py
@@ -1,4 +1,8 @@
import json
+import os
+import subprocess
+import sys
+import textwrap
import warnings
import pytest
@@ -42,6 +46,32 @@ def test_agent_timezone_rejects_unknown_iana_name() -> None:
Config.model_validate({"agents": {"defaults": {"timezone": "Not/AZone"}}})
+def test_agent_timezones_use_packaged_data_without_system_database() -> None:
+ script = textwrap.dedent(
+ """\
+ from zoneinfo import TZPATH
+
+ from nanobot.config.schema import Config
+
+ assert not TZPATH
+ for name in ("UTC", "Asia/Shanghai"):
+ config = Config.model_validate({"agents": {"defaults": {"timezone": name}}})
+ serialized = config.model_dump(mode="json", by_alias=True)
+ restored = Config.model_validate(serialized)
+ assert restored.agents.defaults.timezone == name
+ """
+ )
+ result = subprocess.run(
+ [sys.executable, "-c", script],
+ env=os.environ | {"PYTHONTZPATH": ""},
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
+ assert result.returncode == 0, result.stderr
+
+
def test_provider_api_type_accepts_exact_values_only() -> None:
config = Config.model_validate({
"providers": {