summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorPaul Monson <paulmon@users.noreply.github.com>2019-07-18 13:56:59 (GMT)
committerPaul Ganssle <pganssle@users.noreply.github.com>2019-07-18 13:56:59 (GMT)
commit9cd39b16e2655f748f7aa8d20bca4812da00ba70 (patch)
tree4f812aedf58d207e3c4d41968f534bff8551daba /Lib/test/support
parent1b3892243433da7eae7f5f3a4f98f13d309c8926 (diff)
downloadcpython-9cd39b16e2655f748f7aa8d20bca4812da00ba70.zip
cpython-9cd39b16e2655f748f7aa8d20bca4812da00ba70.tar.gz
cpython-9cd39b16e2655f748f7aa8d20bca4812da00ba70.tar.bz2
bpo-37552: Skip failing tests in strptime/strftime with UCRT version 17763.615 (#14460)
A bug in MSVC UCRT version 17763.615 (which has been fixed in newer versions) is causing test failures in some strptime/strftime tests when the default code page is c65001. This change selectively skips the tests affected by this.
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 423bb3e..4bf42e0 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -14,6 +14,7 @@ import gc
import glob
import importlib
import importlib.util
+import locale
import logging.handlers
import nntplib
import os
@@ -92,7 +93,7 @@ __all__ = [
"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_strfptime",
"ignore_warnings",
# sys
"is_jython", "is_android", "check_impl_detail", "unix_shell",
@@ -2501,6 +2502,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_strfptime(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 strptime/strftime")(test) if _buggy_ucrt else test
+
class PythonSymlink:
"""Creates a symlink for the current Python executable"""
def __init__(self, link=None):