From 2e8cc0adcce8d6cd309006f5c82ac8f19cb265cb Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Fri, 28 Jun 2019 15:38:57 -0700 Subject: [PATCH 1/7] bpo-36511 skip strptime/strftime cp65001 failures --- Lib/test/test_strptime.py | 10 ++++++++++ Lib/test/test_time.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 623da401eee4ff..e65968db08f8b9 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -135,6 +135,8 @@ def test_pattern_escaping(self): "%s does not have re characters escaped properly" % pattern_string) + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_compile(self): # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) @@ -365,6 +367,8 @@ def test_bad_offset(self): _strptime._strptime("-01:3030", "%z") self.assertEqual("Inconsistent use of : in -01:3030", str(err.exception)) + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_timezone(self): # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. @@ -489,6 +493,8 @@ class CalculationTests(unittest.TestCase): def setUp(self): self.time_tuple = time.gmtime() + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_julian_calculation(self): # Make sure that when Julian is missing that it is calculated format_string = "%Y %m %d %H %M %S %w %Z" @@ -498,6 +504,8 @@ def test_julian_calculation(self): "Calculation of tm_yday failed; %s != %s" % (result.tm_yday, self.time_tuple.tm_yday)) + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_gregorian_calculation(self): # Test that Gregorian date can be calculated from Julian day format_string = "%Y %H %M %S %w %j %Z" @@ -512,6 +520,8 @@ def test_gregorian_calculation(self): self.time_tuple.tm_year, self.time_tuple.tm_mon, self.time_tuple.tm_mday)) + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_day_of_week_calculation(self): # Test that the day of the week is calculated as needed format_string = "%Y %m %d %H %S %j %Z" diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index f790d43b6f4746..0936e670f0dd3d 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -250,6 +250,8 @@ def test_default_values_for_zero(self): result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8) self.assertEqual(expected, result) + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_strptime(self): # Should be able to go round-trip from strftime to strptime without # raising an exception. @@ -673,6 +675,8 @@ class TestStrftime4dyear(_TestStrftimeYear, _Test4dYear, unittest.TestCase): class TestPytime(unittest.TestCase): @unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") + @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', + 'issue in MSVC UCRT') def test_localtime_timezone(self): # Get the localtime and examine it for the offset and zone. From a805590e38911e829a2a65f5e3a548bb877b5e50 Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Wed, 10 Jul 2019 14:19:30 -0700 Subject: [PATCH 2/7] add bpo-37552 comments --- Lib/test/test_strptime.py | 5 +++++ Lib/test/test_time.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index e65968db08f8b9..6edea83620eb1b 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -135,6 +135,7 @@ def test_pattern_escaping(self): "%s does not have re characters escaped properly" % pattern_string) + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_compile(self): @@ -367,6 +368,7 @@ def test_bad_offset(self): _strptime._strptime("-01:3030", "%z") self.assertEqual("Inconsistent use of : in -01:3030", str(err.exception)) + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_timezone(self): @@ -493,6 +495,7 @@ class CalculationTests(unittest.TestCase): def setUp(self): self.time_tuple = time.gmtime() + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_julian_calculation(self): @@ -504,6 +507,7 @@ def test_julian_calculation(self): "Calculation of tm_yday failed; %s != %s" % (result.tm_yday, self.time_tuple.tm_yday)) + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_gregorian_calculation(self): @@ -520,6 +524,7 @@ def test_gregorian_calculation(self): self.time_tuple.tm_year, self.time_tuple.tm_mon, self.time_tuple.tm_mday)) + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_day_of_week_calculation(self): diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 0936e670f0dd3d..a7804b519799cc 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -250,6 +250,7 @@ def test_default_values_for_zero(self): result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8) self.assertEqual(expected, result) + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') def test_strptime(self): @@ -674,9 +675,10 @@ class TestStrftime4dyear(_TestStrftimeYear, _Test4dYear, unittest.TestCase): class TestPytime(unittest.TestCase): - @unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") + # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', 'issue in MSVC UCRT') + @unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") def test_localtime_timezone(self): # Get the localtime and examine it for the offset and zone. From 6cfcddb3c8fbd5e046ee2d3f7cf6d8fe4a1d06d1 Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Tue, 16 Jul 2019 18:12:22 -0700 Subject: [PATCH 3/7] refactor skips --- Lib/test/support/__init__.py | 24 +++++++++++++++++++++++- Lib/test/test_strptime.py | 21 ++++++--------------- Lib/test/test_time.py | 9 +++------ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index b5538d22fb2ace..dbc6f9647dc481 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -15,6 +15,7 @@ import importlib import importlib.util import io +import locale import logging.handlers import nntplib import os @@ -93,7 +94,7 @@ "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", "anticipate_failure", "load_package_tests", "detect_api_mismatch", - "check__all__", "skip_unless_bind_unix_socket", + "check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt" "ignore_warnings", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", @@ -2500,6 +2501,27 @@ def skip_unless_symlink(test): msg = "Requires functional symlink implementation" return test if ok else unittest.skip(msg)(test) +_buggy_ucrt = None +def skip_if_buggy_ucrt(test): + """ + Skip decorator for tests that use buggy strptime/strftime + + If the UCRT bugs are present time.localtime().tm_zone will be + an empty string, otherwise we assume the UCRT bugs are fixed + + See bpo-37552 [Windows] strptime/strftime return invalid + results with UCRT version 17763.615 + """ + global _buggy_ucrt + if _buggy_ucrt is None: + if(sys.platform == 'win32' and + locale.getdefaultlocale()[1] == 'cp65001' and + time.localtime().tm_zone == ''): + _buggy_ucrt = True + else: + _buggy_ucrt = False + return unittest.skip("buggy MSVC UCRT")(test) if _buggy_ucrt else test + _can_xattr = None def can_xattr(): global _can_xattr diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 6edea83620eb1b..4ee2aaf176f5ac 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -7,6 +7,7 @@ import os import sys from test import support +from test.support import skip_if_buggy_ucrt from datetime import date as datetime_date import _strptime @@ -135,9 +136,7 @@ def test_pattern_escaping(self): "%s does not have re characters escaped properly" % pattern_string) - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_compile(self): # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) @@ -368,9 +367,7 @@ def test_bad_offset(self): _strptime._strptime("-01:3030", "%z") self.assertEqual("Inconsistent use of : in -01:3030", str(err.exception)) - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_timezone(self): # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. @@ -495,9 +492,7 @@ class CalculationTests(unittest.TestCase): def setUp(self): self.time_tuple = time.gmtime() - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_julian_calculation(self): # Make sure that when Julian is missing that it is calculated format_string = "%Y %m %d %H %M %S %w %Z" @@ -507,9 +502,7 @@ def test_julian_calculation(self): "Calculation of tm_yday failed; %s != %s" % (result.tm_yday, self.time_tuple.tm_yday)) - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_gregorian_calculation(self): # Test that Gregorian date can be calculated from Julian day format_string = "%Y %H %M %S %w %j %Z" @@ -524,9 +517,7 @@ def test_gregorian_calculation(self): self.time_tuple.tm_year, self.time_tuple.tm_mon, self.time_tuple.tm_mday)) - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_day_of_week_calculation(self): # Test that the day of the week is calculated as needed format_string = "%Y %m %d %H %S %j %Z" diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index a7804b519799cc..c9486267fefc60 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -14,6 +14,7 @@ except ImportError: _testcapi = None +from test.support import skip_if_buggy_ucrt # Max year is only limited by the size of C int. SIZEOF_INT = sysconfig.get_config_var('SIZEOF_INT') or 4 @@ -250,9 +251,7 @@ def test_default_values_for_zero(self): result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8) self.assertEqual(expected, result) - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt def test_strptime(self): # Should be able to go round-trip from strftime to strptime without # raising an exception. @@ -675,9 +674,7 @@ class TestStrftime4dyear(_TestStrftimeYear, _Test4dYear, unittest.TestCase): class TestPytime(unittest.TestCase): - # bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 - @unittest.skipIf(sys.platform == 'win32' and locale.getdefaultlocale()[1] == 'cp65001', - 'issue in MSVC UCRT') + @skip_if_buggy_ucrt @unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") def test_localtime_timezone(self): From ce724042f209823029ad26317b6c410146fd5a2c Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Tue, 16 Jul 2019 18:19:59 -0700 Subject: [PATCH 4/7] fix bad merge --- Lib/test/support/__init__.py | 80 +----------------------------------- 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index ca706db0af2a92..66f32e4f5fe725 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -14,7 +14,7 @@ import glob import importlib import importlib.util -import gio +import io import locale import logging.handlers import nntplib @@ -2524,84 +2524,6 @@ def skip_if_buggy_ucrt(test): _buggy_ucrt = False return unittest.skip("buggy MSVC UCRT")(test) if _buggy_ucrt else test -class PythonSymlink: - """Creates a symlink for the current Python executable""" - def __init__(self, link=None): - self.link = link or os.path.abspath(TESTFN) - self._linked = [] - self.real = os.path.realpath(sys.executable) - self._also_link = [] - - self._env = None - - self._platform_specific() - - def _platform_specific(self): - pass - - if sys.platform == "win32": - def _platform_specific(self): - import _winapi - - if os.path.lexists(self.real) and not os.path.exists(self.real): - # App symlink appears to not exist, but we want the - # real executable here anyway - self.real = _winapi.GetModuleFileName(0) - - dll = _winapi.GetModuleFileName(sys.dllhandle) - src_dir = os.path.dirname(dll) - dest_dir = os.path.dirname(self.link) - self._also_link.append(( - dll, - os.path.join(dest_dir, os.path.basename(dll)) - )) - for runtime in glob.glob(os.path.join(src_dir, "vcruntime*.dll")): - self._also_link.append(( - runtime, - os.path.join(dest_dir, os.path.basename(runtime)) - )) - - self._env = {k.upper(): os.getenv(k) for k in os.environ} - self._env["PYTHONHOME"] = os.path.dirname(self.real) - if sysconfig.is_python_build(True): - self._env["PYTHONPATH"] = os.path.dirname(os.__file__) - - def __enter__(self): - os.symlink(self.real, self.link) - self._linked.append(self.link) - for real, link in self._also_link: - os.symlink(real, link) - self._linked.append(link) - return self - - def __exit__(self, exc_type, exc_value, exc_tb): - for link in self._linked: - try: - os.remove(link) - except IOError as ex: - if verbose: - print("failed to clean up {}: {}".format(link, ex)) - - def _call(self, python, args, env, returncode): - cmd = [python, *args] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, env=env) - r = p.communicate() - if p.returncode != returncode: - if verbose: - print(repr(r[0])) - print(repr(r[1]), file=sys.stderr) - raise RuntimeError( - 'unexpected return code: {0} (0x{0:08X})'.format(p.returncode)) - return r - - def call_real(self, *args, returncode=0): - return self._call(self.real, args, None, returncode) - - def call_link(self, *args, returncode=0): - return self._call(self.link, args, self._env, returncode) - - _can_xattr = None def can_xattr(): global _can_xattr From 7665b54cb9c36dac25399e7cc0ab14fda0de7999 Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Tue, 16 Jul 2019 18:30:36 -0700 Subject: [PATCH 5/7] fix bad fix of bad merge --- Lib/test/support/__init__.py | 79 +++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 66f32e4f5fe725..a19475de7be38f 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -14,7 +14,6 @@ import glob import importlib import importlib.util -import io import locale import logging.handlers import nntplib @@ -2524,6 +2523,84 @@ def skip_if_buggy_ucrt(test): _buggy_ucrt = False return unittest.skip("buggy MSVC UCRT")(test) if _buggy_ucrt else test +class PythonSymlink: + """Creates a symlink for the current Python executable""" + def __init__(self, link=None): + self.link = link or os.path.abspath(TESTFN) + self._linked = [] + self.real = os.path.realpath(sys.executable) + self._also_link = [] + + self._env = None + + self._platform_specific() + + def _platform_specific(self): + pass + + if sys.platform == "win32": + def _platform_specific(self): + import _winapi + + if os.path.lexists(self.real) and not os.path.exists(self.real): + # App symlink appears to not exist, but we want the + # real executable here anyway + self.real = _winapi.GetModuleFileName(0) + + dll = _winapi.GetModuleFileName(sys.dllhandle) + src_dir = os.path.dirname(dll) + dest_dir = os.path.dirname(self.link) + self._also_link.append(( + dll, + os.path.join(dest_dir, os.path.basename(dll)) + )) + for runtime in glob.glob(os.path.join(src_dir, "vcruntime*.dll")): + self._also_link.append(( + runtime, + os.path.join(dest_dir, os.path.basename(runtime)) + )) + + self._env = {k.upper(): os.getenv(k) for k in os.environ} + self._env["PYTHONHOME"] = os.path.dirname(self.real) + if sysconfig.is_python_build(True): + self._env["PYTHONPATH"] = os.path.dirname(os.__file__) + + def __enter__(self): + os.symlink(self.real, self.link) + self._linked.append(self.link) + for real, link in self._also_link: + os.symlink(real, link) + self._linked.append(link) + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + for link in self._linked: + try: + os.remove(link) + except IOError as ex: + if verbose: + print("failed to clean up {}: {}".format(link, ex)) + + def _call(self, python, args, env, returncode): + cmd = [python, *args] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, env=env) + r = p.communicate() + if p.returncode != returncode: + if verbose: + print(repr(r[0])) + print(repr(r[1]), file=sys.stderr) + raise RuntimeError( + 'unexpected return code: {0} (0x{0:08X})'.format(p.returncode)) + return r + + def call_real(self, *args, returncode=0): + return self._call(self.real, args, None, returncode) + + def call_link(self, *args, returncode=0): + return self._call(self.link, args, self._env, returncode) + + _can_xattr = None def can_xattr(): global _can_xattr From ccde057119552439cec76f01eb2add0143d0c8da Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Tue, 16 Jul 2019 18:47:06 -0700 Subject: [PATCH 6/7] commas are important too --- Lib/test/support/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index a19475de7be38f..40abfcb7fc99a7 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -93,7 +93,7 @@ "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", "anticipate_failure", "load_package_tests", "detect_api_mismatch", - "check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt" + "check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt", "ignore_warnings", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", From e8001cbbc20a60ed504d28acc5865cd3383d113a Mon Sep 17 00:00:00 2001 From: Paul Monson Date: Wed, 17 Jul 2019 10:50:06 -0700 Subject: [PATCH 7/7] include strftime/strptime in skip --- Lib/test/support/__init__.py | 6 +++--- Lib/test/test_strptime.py | 12 ++++++------ Lib/test/test_time.py | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 40abfcb7fc99a7..4bf42e0eb423ca 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -93,7 +93,7 @@ "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", "anticipate_failure", "load_package_tests", "detect_api_mismatch", - "check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt", + "check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt_strfptime", "ignore_warnings", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", @@ -2503,7 +2503,7 @@ def skip_unless_symlink(test): return test if ok else unittest.skip(msg)(test) _buggy_ucrt = None -def skip_if_buggy_ucrt(test): +def skip_if_buggy_ucrt_strfptime(test): """ Skip decorator for tests that use buggy strptime/strftime @@ -2521,7 +2521,7 @@ def skip_if_buggy_ucrt(test): _buggy_ucrt = True else: _buggy_ucrt = False - return unittest.skip("buggy MSVC UCRT")(test) if _buggy_ucrt else test + return unittest.skip("buggy MSVC UCRT strptime/strftime")(test) if _buggy_ucrt else test class PythonSymlink: """Creates a symlink for the current Python executable""" diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 4ee2aaf176f5ac..55a0f426731a5d 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -7,7 +7,7 @@ import os import sys from test import support -from test.support import skip_if_buggy_ucrt +from test.support import skip_if_buggy_ucrt_strfptime from datetime import date as datetime_date import _strptime @@ -136,7 +136,7 @@ def test_pattern_escaping(self): "%s does not have re characters escaped properly" % pattern_string) - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_compile(self): # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) @@ -367,7 +367,7 @@ def test_bad_offset(self): _strptime._strptime("-01:3030", "%z") self.assertEqual("Inconsistent use of : in -01:3030", str(err.exception)) - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_timezone(self): # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. @@ -492,7 +492,7 @@ class CalculationTests(unittest.TestCase): def setUp(self): self.time_tuple = time.gmtime() - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_julian_calculation(self): # Make sure that when Julian is missing that it is calculated format_string = "%Y %m %d %H %M %S %w %Z" @@ -502,7 +502,7 @@ def test_julian_calculation(self): "Calculation of tm_yday failed; %s != %s" % (result.tm_yday, self.time_tuple.tm_yday)) - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_gregorian_calculation(self): # Test that Gregorian date can be calculated from Julian day format_string = "%Y %H %M %S %w %j %Z" @@ -517,7 +517,7 @@ def test_gregorian_calculation(self): self.time_tuple.tm_year, self.time_tuple.tm_mon, self.time_tuple.tm_mday)) - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_day_of_week_calculation(self): # Test that the day of the week is calculated as needed format_string = "%Y %m %d %H %S %j %Z" diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index c9486267fefc60..8d8d31e7825e68 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -14,7 +14,7 @@ except ImportError: _testcapi = None -from test.support import skip_if_buggy_ucrt +from test.support import skip_if_buggy_ucrt_strfptime # Max year is only limited by the size of C int. SIZEOF_INT = sysconfig.get_config_var('SIZEOF_INT') or 4 @@ -251,7 +251,7 @@ def test_default_values_for_zero(self): result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8) self.assertEqual(expected, result) - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime def test_strptime(self): # Should be able to go round-trip from strftime to strptime without # raising an exception. @@ -674,7 +674,7 @@ class TestStrftime4dyear(_TestStrftimeYear, _Test4dYear, unittest.TestCase): class TestPytime(unittest.TestCase): - @skip_if_buggy_ucrt + @skip_if_buggy_ucrt_strfptime @unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") def test_localtime_timezone(self):