102 lines
4.1 KiB
Diff
102 lines
4.1 KiB
Diff
From a00569162f1dc01aec917a98ab365c2ef5ac2696 Mon Sep 17 00:00:00 2001
|
|
From: Naveen M K <naveen521kk@gmail.com>
|
|
Date: Sun, 5 Jun 2022 20:28:53 +0530
|
|
Subject: [PATCH 054/N] tests: Fix some failing tests
|
|
|
|
- In `test_sysconfig`, ignore `test_sysconfig.TestSysConfig.test_user_similar` test failure.
|
|
- Copy `get_platform()` from from distutils.utils to test_importlib/test_windows.py.
|
|
- some basic fixes for test_getpath
|
|
- test_sysconfig.py: fix tests related to mingw
|
|
---
|
|
Lib/test/test_getpath.py | 3 +++
|
|
Lib/test/test_importlib/test_windows.py | 23 +++++++++++++++++++++++
|
|
Lib/test/test_sysconfig.py | 6 +++++-
|
|
3 files changed, 31 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/Lib/test/test_getpath.py b/Lib/test/test_getpath.py
|
|
index d5dcdad..0c4ab74 100644
|
|
--- a/Lib/test/test_getpath.py
|
|
+++ b/Lib/test/test_getpath.py
|
|
@@ -852,6 +852,7 @@ DEFAULT_NAMESPACE = dict(
|
|
ENV_PYTHONHOME="",
|
|
ENV_PYTHONEXECUTABLE="",
|
|
ENV___PYVENV_LAUNCHER__="",
|
|
+ ENV_MSYSTEM="",
|
|
argv0="",
|
|
py_setpath="",
|
|
real_executable="",
|
|
@@ -891,6 +892,7 @@ class MockNTNamespace(dict):
|
|
self.update(DEFAULT_NAMESPACE)
|
|
self["config"] = DEFAULT_CONFIG.copy()
|
|
self["os_name"] = "nt"
|
|
+ self["is_mingw"] = 0
|
|
self["PLATLIBDIR"] = "DLLs"
|
|
self["PYWINVER"] = "9.8-XY"
|
|
self["VPATH"] = r"..\.."
|
|
@@ -1067,6 +1069,7 @@ class MockPosixNamespace(dict):
|
|
self.update(DEFAULT_NAMESPACE)
|
|
self["config"] = DEFAULT_CONFIG.copy()
|
|
self["os_name"] = "posix"
|
|
+ self["is_mingw"] = 0
|
|
self["PLATLIBDIR"] = "lib"
|
|
self["WITH_NEXT_FRAMEWORK"] = 0
|
|
super().__init__(*a, **kw)
|
|
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
|
|
index 8a9a8ff..be96884 100644
|
|
--- a/Lib/test/test_importlib/test_windows.py
|
|
+++ b/Lib/test/test_importlib/test_windows.py
|
|
@@ -24,6 +24,29 @@ def get_platform():
|
|
'x64' : 'win-amd64',
|
|
'arm' : 'win-arm32',
|
|
}
|
|
+ if os.name == 'nt':
|
|
+ if sys._is_mingw:
|
|
+ platform = "mingw"
|
|
+ if "amd64" in sys.version.lower():
|
|
+ platform += "_x86_64"
|
|
+ elif "arm64" in sys.version.lower():
|
|
+ platform += "_aarch64"
|
|
+ elif "arm" in sys.version.lower():
|
|
+ platform += "_armv7"
|
|
+ else:
|
|
+ platform += "_i686"
|
|
+
|
|
+ if "ucrt" in sys.version.lower():
|
|
+ platform += "_ucrt"
|
|
+ else:
|
|
+ platform += "_msvcrt"
|
|
+
|
|
+ if "clang" in sys.version.lower():
|
|
+ platform += "_llvm"
|
|
+ else:
|
|
+ platform += "_gnu"
|
|
+
|
|
+ return platform
|
|
if ('VSCMD_ARG_TGT_ARCH' in os.environ and
|
|
os.environ['VSCMD_ARG_TGT_ARCH'] in TARGET_TO_PLAT):
|
|
return TARGET_TO_PLAT[os.environ['VSCMD_ARG_TGT_ARCH']]
|
|
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
|
|
index 9723300..691b84f 100644
|
|
--- a/Lib/test/test_sysconfig.py
|
|
+++ b/Lib/test/test_sysconfig.py
|
|
@@ -208,7 +208,7 @@ class TestSysConfig(unittest.TestCase):
|
|
self.assertEqual(libpath, sysconfig.get_path('purelib', scheme='nt_venv', vars=vars))
|
|
|
|
def test_venv_scheme(self):
|
|
- if sys.platform == 'win32':
|
|
+ if not sys._is_mingw and sys.platform == 'win32':
|
|
self.assertEqual(
|
|
sysconfig.get_path('scripts', scheme='venv'),
|
|
sysconfig.get_path('scripts', scheme='nt_venv')
|
|
@@ -428,6 +428,10 @@ class TestSysConfig(unittest.TestCase):
|
|
if HAS_USER_BASE:
|
|
user_path = get_path(name, 'posix_user')
|
|
expected = os.path.normpath(global_path.replace(base, user, 1))
|
|
+ if os.name == 'nt' and sys._is_mingw:
|
|
+ expected = expected.replace(
|
|
+ f'python{sysconfig.get_python_version()}',
|
|
+ f'python{sysconfig.get_python_version()}-{get_platform()}')
|
|
# bpo-44860: platlib of posix_user doesn't use sys.platlibdir,
|
|
# whereas posix_prefix does.
|
|
if name == 'platlib':
|