]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Make the tzdata package a dependency on Windows
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 9 Feb 2022 21:03:35 +0000 (22:03 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 11 Feb 2022 00:58:24 +0000 (01:58 +0100)
The package replaces the missing system tz database and allows to avoid
the warning and return timestamps in the client timezone instead of in
UTC.

Close #223

docs/news.rst
psycopg/setup.cfg
tests/test_conninfo.py
tests/types/test_datetime.py

index 09a22a910ed14837bebb2494d48236791794ba3b..1a2ae4eab8b28aebb462ee83e871084c5b84a516 100644 (file)
@@ -7,6 +7,16 @@
 ``psycopg`` release notes
 =========================
 
+Future releases
+---------------
+
+Psycopg 3.0.9
+^^^^^^^^^^^^^
+
+- Add the `!tzdata` package as a dependency on Windows in order to handle time
+  zones (:ticket:`#223`).
+
+
 Current release
 ---------------
 
index e270c0dabfe1931ff1896b307b6fb0eb3bd3517c..c981ba2ed30c90629c994a162bebb0ae468195c9 100644 (file)
@@ -41,6 +41,7 @@ zip_safe = False
 install_requires =
     backports.zoneinfo >= 0.2.0; python_version < "3.9"
     typing_extensions >= 3.10; python_version < "3.8"
+    tzdata; sys_platform == "win32"
 
 [options.package_data]
 psycopg = py.typed
index 63573d78b52ac06d2d787545d16e2480b6135b4a..65bc9fc4b1abfe99b52f056b150024b8cd18a4af 100644 (file)
@@ -1,4 +1,3 @@
-import sys
 import datetime as dt
 
 import pytest
@@ -218,7 +217,6 @@ class TestConnectionInfo:
         with pytest.raises(psycopg.OperationalError):
             conn.info.backend_pid
 
-    @pytest.mark.skipif(sys.platform == "win32", reason="no IANA db on Windows")
     def test_timezone(self, conn):
         conn.execute("set timezone to 'Europe/Rome'")
         tz = conn.info.timezone
index 199f679f1862b507e187867af3a106f58e2dd3c8..a4bfa6a2fac757d13a81b36bb2b265bad06681e7 100644 (file)
@@ -291,8 +291,6 @@ class TestDateTimeTz:
     )
     @pytest.mark.parametrize("fmt_out", pq.Format)
     def test_load_datetimetz_tz(self, conn, fmt_out, tzname, expr, tzoff):
-        if "/" in tzname and sys.platform == "win32":
-            pytest.skip("no IANA db on Windows")
         conn.execute("select set_config('TimeZone', %s, true)", [tzname])
         cur = conn.cursor(binary=fmt_out)
         ts = cur.execute("select %s::timestamptz", [expr]).fetchone()[0]
@@ -341,7 +339,6 @@ class TestDateTimeTz:
         sys.version_info < (3, 7), reason="no seconds in tz offset"
     )
 
-    @pytest.mark.xfail(sys.platform == "win32", reason="no IANA db on Windows")
     @pytest.mark.parametrize(
         "valname, tzval, tzname",
         [