From: Mike Bayer Date: Mon, 2 Dec 2019 16:47:08 +0000 (-0500) Subject: Skip sub-minute timezone tests for Python 3 < 3.7 X-Git-Tag: rel_1_3_12~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42d1f8b11d50436e9e7a9a8f6d51cbfc5d6dae59;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Skip sub-minute timezone tests for Python 3 < 3.7 The datetime.timezone class as of Python 3.7, or SQLAlchemy's port for Python 2, supports seconds and microseconds. For Python 3.6 and earlier, it is not supported. Fixes: #5016 Change-Id: Ia347d5a9958c0fa53317b2e340162e2009667bc2 (cherry picked from commit 380f4389922004589bfa7cb4f9b8c8208aa68659) --- diff --git a/test/base/test_utils.py b/test/base/test_utils.py index 7004239fe8..23436a6fd6 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -2782,13 +2782,18 @@ class TimezoneTest(fixtures.TestBase): (datetime.timedelta(0), "UTC"), (datetime.timedelta(hours=5), "UTC+05:00"), (datetime.timedelta(hours=5, minutes=10), "UTC+05:10"), - (datetime.timedelta(hours=5, minutes=10, seconds=27), "UTC+05:10:27"), + ( + datetime.timedelta(hours=5, minutes=10, seconds=27), + "UTC+05:10:27", + testing.requires.granular_timezone, + ), (datetime.timedelta(hours=-3, minutes=10), "UTC-02:50"), ( datetime.timedelta( hours=5, minutes=10, seconds=27, microseconds=550 ), "UTC+05:10:27.000550", + testing.requires.granular_timezone, ), ) def test_tzname(self, td, expected): diff --git a/test/requirements.py b/test/requirements.py index c94fd0e0e2..8f0cbc1b77 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -1302,6 +1302,19 @@ class DefaultRequirements(SuiteRequirements): "Python issue 8743 fixed in Python 2.7.8", ) + @property + def granular_timezone(self): + """the datetime.timezone class, or SQLAlchemy's port, supports + seconds and microseconds. + + SQLAlchemy ported the Python 3.7 version for Python 2, so + it passes on that. For Python 3.6 and earlier, it is not supported. + + """ + return exclusions.skip_if( + lambda: sys.version_info >= (3,) and sys.version_info < (3, 7) + ) + @property def selectone(self): """target driver must support the literal statement 'select 1'"""