Skip to content

Commit

Permalink
Merge pull request python#12 from paulmon/win32-arm-nanoserver
Browse files Browse the repository at this point in the history
Windows arm32 - fix failing tests or skip
  • Loading branch information
paulmon authored Oct 12, 2018
2 parents 2f233f6 + 84e11fe commit f01f3c6
Show file tree
Hide file tree
Showing 114 changed files with 277 additions and 267 deletions.
2 changes: 1 addition & 1 deletion Lib/_osx_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _find_executable(executable, path=None):
paths = path.split(os.pathsep)
base, ext = os.path.splitext(executable)

if (sys.platform == 'win32') and (ext != '.exe'):
if (sys.platform.startswith('win')) and (ext != '.exe'):
executable = executable + '.exe'

if not os.path.isfile(executable):
Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys
# Import _thread instead of threading to reduce startup cost
from _thread import allocate_lock as Lock
if sys.platform in {'win32', 'cygwin'}:
if sys.platform in {'win32', 'win-arm', 'cygwin'}:
from msvcrt import setmode as _setmode
else:
_setmode = None
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
tasks.__all__ +
transports.__all__)

if sys.platform == 'win32': # pragma: no cover
if sys.platform.startswith('win'): # pragma: no cover
from .windows_events import *
__all__ += windows_events.__all__
else:
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)


if sys.platform == 'win32': # pragma: no cover
if sys.platform.startswith('win'): # pragma: no cover
raise ImportError('Signals are not really supported on Windows')


Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/windows_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

if sys.platform != 'win32': # pragma: no cover
if not sys.platform.startswith('win'): # pragma: no cover
raise ImportError('win32 only')

import _winapi
Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class X(Structure):
self.assertEqual(x.a, "abc")
self.assertEqual(type(x.a), str)

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
def test_BSTR(self):
from _ctypes import _SimpleCData
class BSTR(_SimpleCData):
Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/test/test_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Test_OpenGL_libs(unittest.TestCase):
@classmethod
def setUpClass(cls):
lib_gl = lib_glu = lib_gle = None
if sys.platform == "win32":
if sys.platform.startswith("win"):
lib_gl = find_library("OpenGL32")
lib_glu = find_library("Glu32")
elif sys.platform == "darwin":
Expand Down
6 changes: 3 additions & 3 deletions Lib/ctypes/test/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import _ctypes_test
dll = CDLL(_ctypes_test.__file__)
if sys.platform == "win32":
if sys.platform.startswith("win"):
windll = WinDLL(_ctypes_test.__file__)

class POINT(Structure):
Expand Down Expand Up @@ -341,7 +341,7 @@ class S2H(Structure):
s2h = dll.ret_2h_func(inp)
self.assertEqual((s2h.x, s2h.y), (99*2, 88*3))

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
def test_struct_return_2H_stdcall(self):
class S2H(Structure):
_fields_ = [("x", c_short),
Expand Down Expand Up @@ -369,7 +369,7 @@ class S8I(Structure):
self.assertEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h),
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
def test_struct_return_8H_stdcall(self):
class S8I(Structure):
_fields_ = [("a", c_int),
Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/test/test_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def test_pointers_bool(self):
self.assertEqual(bool(CFUNCTYPE(None)(42)), True)

# COM methods are boolean True:
if sys.platform == "win32":
if sys.platform.startswith("win"):
mth = WINFUNCTYPE(None)(42, "name", (), None)
self.assertEqual(bool(mth), True)

Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/test/test_random_things.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def callback_func(arg):
42 / arg
raise ValueError(arg)

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
class call_function_TestCase(unittest.TestCase):
# _ctypes.call_function is deprecated and private, but used by
# Gary Bishp's readline module. If we have it, we must test it as well.
Expand Down
12 changes: 6 additions & 6 deletions Lib/ctypes/test/test_win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import _ctypes_test

# Only windows 32-bit has different calling conventions.
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
@unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int),
"sizeof c_void_p and c_int differ")
class WindowsTestCase(unittest.TestCase):
@unittest.skipIf(platform.win32_editionId() == 'IoTUAP', "API not present on Windows 10 IoT Core")
@unittest.skipIf(platform.win32_is_iot(), "API not present on Windows 10 IoT Core")
def test_callconv_1(self):
# Testing stdcall function

Expand All @@ -27,7 +27,7 @@ def test_callconv_1(self):
# (8 bytes in excess)
self.assertRaises(ValueError, IsWindow, 0, 0, 0)

@unittest.skipIf(platform.win32_editionId() == 'IoTUAP', "API not present on Windows 10 IoT Core")
@unittest.skipIf(platform.win32_is_iot(), "API not present on Windows 10 IoT Core")
def test_callconv_2(self):
# Calling stdcall function as cdecl

Expand All @@ -37,7 +37,7 @@ def test_callconv_2(self):
# (4 bytes missing) or wrong calling convention
self.assertRaises(ValueError, IsWindow, None)

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
class FunctionCallTestCase(unittest.TestCase):
@unittest.skipUnless('MSC' in sys.version, "SEH only supported by MSC")
@unittest.skipIf(sys.executable.lower().endswith('_d.exe'),
Expand All @@ -56,7 +56,7 @@ def test_noargs(self):
windll.user32.GetDesktopWindow()


@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
class TestWintypes(unittest.TestCase):
def test_HWND(self):
from ctypes import wintypes
Expand All @@ -80,7 +80,7 @@ def test_COMError(self):
self.assertEqual(ex.text, "text")
self.assertEqual(ex.details, ("details",))

@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
@unittest.skipUnless(sys.platform.startswith("win"), 'Windows-specific test')
class TestWinError(unittest.TestCase):
def test_winerror(self):
# see Issue 16169
Expand Down
1 change: 1 addition & 0 deletions Lib/distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def _find_exe(exe, paths=None):
PLAT_TO_VCVARS = {
'win32' : 'x86',
'win-amd64' : 'x86_amd64',
'win-arm' : 'x86_arm',
}

# A set containing the DLLs that are guaranteed to be available for
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _set_uid_gid(tarinfo):
warn("'compress' will be deprecated.", PendingDeprecationWarning)
# the option varies depending on the platform
compressed_name = archive_name + compress_ext[compress]
if sys.platform == 'win32':
if sys.platform.startswith('win'):
cmd = [compress, archive_name, compressed_name]
else:
cmd = [compress, '-f', archive_name]
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/command/bdist_wininst.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def finalize_options(self):
% self.install_script)

def run(self):
if (sys.platform != "win32" and
if (not sys.platform.startswith("win") and
(self.distribution.has_ext_modules() or
self.distribution.has_c_libraries())):
raise DistutilsPlatformError \
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ def get_libraries(self, ext):
# pyconfig.h that MSVC groks. The other Windows compilers all seem
# to need it mentioned explicitly, though, so that's what we do.
# Append '_d' to the python import library on debug builds.
if sys.platform == "win32":
if sys.platform.startswith("win"):
from distutils._msvccompiler import MSVCCompiler
if not isinstance(self.compiler, MSVCCompiler):
template = "python%d%d"
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/command/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def prune_file_list(self):
self.filelist.exclude_pattern(None, prefix=build.build_base)
self.filelist.exclude_pattern(None, prefix=base_dir)

if sys.platform == 'win32':
if sys.platform.startswith('win'):
seps = r'/|\\'
else:
seps = '/'
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
winreg.HKEY_LOCAL_MACHINE,
winreg.HKEY_CLASSES_ROOT)

NATIVE_WIN64 = (sys.platform == 'win32' and sys.maxsize > 2**32)
NATIVE_WIN64 = (sys.platform.startswith('win') and sys.maxsize > 2**32)
if NATIVE_WIN64:
# Visual C++ is a 32-bit application, so we need to look in
# the corresponding registry branch, if we're running a
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def find_executable(executable, path=None):
paths = path.split(os.pathsep)
base, ext = os.path.splitext(executable)

if (sys.platform == 'win32') and (ext != '.exe'):
if (sys.platform.startswith('win')) and (ext != '.exe'):
executable = executable + '.exe'

if not os.path.isfile(executable):
Expand Down
5 changes: 1 addition & 4 deletions Lib/distutils/tests/test_bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
from distutils.tests import support


SKIP_MESSAGE = (None if platform.win32_editionId() != 'IoTUAP' else
"These tests don't work on windows arm32")

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
@unittest.skipIf(platform.win32_is_iot(), "These tests don't work on Windows IoT Core or nanoserver")
class BuildTestCase(support.TempdirManager,
unittest.TestCase):

Expand Down
4 changes: 2 additions & 2 deletions Lib/distutils/tests/test_bdist_msi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from distutils.tests import support


SKIP_MESSAGE = (None if sys.platform == "win32" and platform.win32_editionId() != 'IoTUAP' else
"These tests require Windows x86 or x64. ARM is not supported")
SKIP_MESSAGE = (None if sys.platform.startswith("win") and not platform.win32_is_iot() else
"These tests require Windows x86 or x64. Windows IoT Core and nanoserver are not supported")

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class BDistMSITestCase(support.TempdirManager,
Expand Down
5 changes: 1 addition & 4 deletions Lib/distutils/tests/test_bdist_wininst.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from distutils.command.bdist_wininst import bdist_wininst
from distutils.tests import support

SKIP_MESSAGE = (None if platform.win32_editionId() != 'IoTUAP' else
"These tests don't work on windows arm32")

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
@unittest.skipIf(platform.win32_is_iot(), "These tests don't work on Windows IoT Core or nanoserver")
class BuildWinInstTestCase(support.TempdirManager,
support.LoggingSilencer,
unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/tests/test_build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_finalize_options(self):
cmd.distribution.libraries = 'WONTWORK'
self.assertRaises(DistutilsSetupError, cmd.finalize_options)

@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
@unittest.skipIf(sys.platform.startswith('win'), "can't test on Windows")
def test_run(self):
pkg_dir, dist = self.create_dist()
cmd = build_clib(dist)
Expand Down
6 changes: 1 addition & 5 deletions Lib/distutils/tests/test_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
# Don't load the xx module more than once.
ALREADY_TESTED = False


SKIP_MESSAGE = (None if platform.win32_editionId() != 'IoTUAP' else
"These tests don't work on windows arm32")

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
@unittest.skipIf(platform.win32_is_iot(), "These tests don't work on Windows IoT Core or nanoserver")
class BuildExtTestCase(TempdirManager,
LoggingSilencer,
unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/tests/test_config_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_dump_file(self):
dump_file(this_file, 'I am the header')
self.assertEqual(len(self._logs), numlines+1)

@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
@unittest.skipIf(sys.platform.startswith('win'), "can't test on Windows")
def test_search_cpp(self):
cmd = missing_compiler_executable(['preprocessor'])
if cmd is not None:
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/tests/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def test_custom_pydistutils(self):
self.assertIn(user_filename, files)

# win32-style
if sys.platform == 'win32':
if sys.platform.startswith('win'):
# home drive should be found
os.environ['HOME'] = temp_dir
files = dist.find_config_files()
Expand Down
4 changes: 2 additions & 2 deletions Lib/distutils/tests/test_msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
</dependency>
</assembly>"""

if sys.platform=="win32" and platform.win32_editionId() != 'IoTUAP':
if sys.platform.startswith("win") and not platform.win32_is_iot():
from distutils.msvccompiler import get_build_version
if get_build_version()>=8.0:
SKIP_MESSAGE = None
else:
SKIP_MESSAGE = "These tests are only for MSVC8.0 or above"
else:
SKIP_MESSAGE = "These tests are only for win32"
SKIP_MESSAGE = "These tests are only for win32 and do not work Windows IoT Core or nanoserver"

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvc9compilerTestCase(support.TempdirManager,
Expand Down
4 changes: 2 additions & 2 deletions Lib/distutils/tests/test_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from test.support import run_unittest


SKIP_MESSAGE = (None if sys.platform == "win32" and platform.win32_editionId() != 'IoTUAP' else
"These tests are only for win32")
SKIP_MESSAGE = (None if sys.platform.startswith("win") and not platform.win32_is_iot() else
"These tests require Windows x86 or x64. Windows IoT Core and nanoserver are not supported")

@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvccompilerTestCase(support.TempdirManager,
Expand Down
4 changes: 2 additions & 2 deletions Lib/distutils/tests/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_spawn(self):

# creating something executable
# through the shell that returns 1
if sys.platform != 'win32':
if not sys.platform.startswith('win'):
exe = os.path.join(tmpdir, 'foo.sh')
self.write_file(exe, '#!%s\nexit 1' % unix_shell)
else:
Expand All @@ -41,7 +41,7 @@ def test_spawn(self):
self.assertRaises(DistutilsExecError, spawn, [exe])

# now something that works
if sys.platform != 'win32':
if not sys.platform.startswith('win'):
exe = os.path.join(tmpdir, 'foo.sh')
self.write_file(exe, '#!%s\nexit 0' % unix_shell)
else:
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/tests/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_SO_in_vars(self):
self.assertIsNotNone(vars['SO'])
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])

@unittest.skipIf(platform.win32_editionId() == 'IoTUAP', "API not present on Windows 10 IoT Core")
@unittest.skipIf(platform.win32_is_iot(), "API not present on Windows 10 IoT Core")
def test_customize_compiler_before_get_config_vars(self):
# Issue #21923: test that a Distribution compiler
# instance can be called without an explicit call to
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/tests/test_unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def tearDown(self):
sys.platform = self._backup_platform
sysconfig.get_config_var = self._backup_get_config_var

@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
@unittest.skipIf(sys.platform.startswith('win'), "can't test on Windows")
def test_runtime_libdir_option(self):
# Issue#5900
#
Expand Down
2 changes: 1 addition & 1 deletion Lib/encodings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def search_function(encoding):
# Register the search_function in the Python codec registry
codecs.register(search_function)

if sys.platform == 'win32':
if sys.platform.startswith('win'):
def _alias_mbcs(encoding):
try:
import _winapi
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/iomenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
pass

locale_decode = 'ascii'
if sys.platform == 'win32':
if sys.platform.startswith('win'):
# On Windows, we could use "mbcs". However, to give the user
# a portable encoding name, we need to find the code page
try:
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Valid arguments for the ...Awareness call below are defined in the following.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32':
if sys.platform.startswith('win'):
import ctypes
PROCESS_SYSTEM_DPI_AWARE = 1
try:
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/zoomheight.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def zoom_height(top):
return
width, height, x, y = map(int, m.groups())
newheight = top.winfo_screenheight()
if sys.platform == 'win32':
if sys.platform.startswith('win'):
newy = 0
newheight = newheight - 72

Expand Down
Loading

0 comments on commit f01f3c6

Please sign in to comment.