]> 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 01:01:22 +0000 (02:01 +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 f6ae9468e1e7f50fe90750707e673f0b7df40357..1e6cd9437ecbf6541df948d64cdcc2e666907f44 100644 (file)
@@ -21,6 +21,13 @@ Psycopg 3.1 (unreleased)
 - Drop support for Python 3.6.
 
 
+Psycopg 3.0.9 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Add the `!tzdata` package as a dependency on Windows in order to handle time
+  zones (:ticket:`#223`).
+
+
 Current release
 ---------------
 
index f0d3b9f9736db038eca52c106abb062e5318482b..fac80d853ca20efa89330416e573898143a9fd6c 100644 (file)
@@ -40,6 +40,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 79ceeefb341cdafec61ad7e339be973df47a14b3..05416d7432773d4629eb73ae69d13e38eeadb111 100644 (file)
@@ -1,4 +1,3 @@
-import sys
 import datetime as dt
 
 import pytest
@@ -291,8 +290,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]
@@ -337,7 +334,6 @@ class TestDateTimeTz:
         assert rec[0] == want
         assert rec[1] == 11111111
 
-    @pytest.mark.xfail(sys.platform == "win32", reason="no IANA db on Windows")
     @pytest.mark.parametrize(
         "valname, tzval, tzname",
         [