summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_windows.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2021-03-26 18:55:07 (GMT)
committerGitHub <noreply@github.com>2021-03-26 18:55:07 (GMT)
commit1899087b21119c5c64cd41619b542c0bf0ab5751 (patch)
tree400c834041ef28eacaac8fa0169e2482dea8a775 /Lib/test/test_importlib/test_windows.py
parent21a2cabb3795f5170c746ab8f29e9d25c7442550 (diff)
downloadcpython-1899087b21119c5c64cd41619b542c0bf0ab5751.zip
cpython-1899087b21119c5c64cd41619b542c0bf0ab5751.tar.gz
cpython-1899087b21119c5c64cd41619b542c0bf0ab5751.tar.bz2
bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)
Diffstat (limited to 'Lib/test/test_importlib/test_windows.py')
-rw-r--r--Lib/test/test_importlib/test_windows.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
index 8b3f200..64ffe10 100644
--- a/Lib/test/test_importlib/test_windows.py
+++ b/Lib/test/test_importlib/test_windows.py
@@ -7,7 +7,6 @@ import sys
import unittest
from test import support
from test.support import import_helper
-from distutils.util import get_platform
from contextlib import contextmanager
from .util import temp_module
@@ -18,6 +17,25 @@ from winreg import (
EnumKey, CloseKey, DeleteKey, OpenKey
)
+def get_platform():
+ # Port of distutils.util.get_platform().
+ TARGET_TO_PLAT = {
+ 'x86' : 'win32',
+ 'x64' : 'win-amd64',
+ 'arm' : 'win-arm32',
+ }
+ 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']]
+ elif 'amd64' in sys.version.lower():
+ return 'win-amd64'
+ elif '(arm)' in sys.version.lower():
+ return 'win-arm32'
+ elif '(arm64)' in sys.version.lower():
+ return 'win-arm64'
+ else:
+ return sys.platform
+
def delete_registry_tree(root, subkey):
try:
hkey = OpenKey(root, subkey, access=KEY_ALL_ACCESS)
@@ -101,7 +119,7 @@ class WindowsExtensionSuffixTests:
self.assertIn(expected_tag, suffixes)
- # Ensure the tags are in the correct order
+ # Ensure the tags are in the correct order.
tagged_i = suffixes.index(expected_tag)
self.assertLess(tagged_i, untagged_i)