Allow CPython tests to run on Mac

This commit is contained in:
Aviv Palivoda
2020-02-06 22:47:49 +02:00
parent e41140cdc7
commit 1e8ea10278
2 changed files with 21 additions and 11 deletions

View File

@@ -428,15 +428,21 @@ class Regrtest:
def display_header(self):
# Print basic platform information
print("==", platform.python_implementation(), *sys.version.split())
print("==", platform.platform(aliased=True),
"%s-endian" % sys.byteorder)
try:
print("==", platform.platform(aliased=True),
"%s-endian" % sys.byteorder)
except:
print("== RustPython: Need to fix platform.platform")
print("== cwd:", os.getcwd())
cpu_count = os.cpu_count()
if cpu_count:
print("== CPU count:", cpu_count)
print("== encodings: locale=%s, FS=%s"
try:
print("== encodings: locale=%s, FS=%s"
% (locale.getpreferredencoding(False),
sys.getfilesystemencoding()))
except:
print("== RustPython: Need to fix encoding stuff")
def get_tests_result(self):
result = []
@@ -608,15 +614,16 @@ class Regrtest:
# If we're on windows and this is the parent runner (not a worker),
# track the load average.
if sys.platform == 'win32' and (self.ns.worker_args is None):
from test.libregrtest.win_utils import WindowsLoadTracker
# TODO: RustPython
# if sys.platform == 'win32' and (self.ns.worker_args is None):
# from test.libregrtest.win_utils import WindowsLoadTracker
try:
self.win_load_tracker = WindowsLoadTracker()
except FileNotFoundError as error:
# Windows IoT Core and Windows Nano Server do not provide
# typeperf.exe for x64, x86 or ARM
print(f'Failed to create WindowsLoadTracker: {error}')
# try:
# self.win_load_tracker = WindowsLoadTracker()
# except FileNotFoundError as error:
# # Windows IoT Core and Windows Nano Server do not provide
# # typeperf.exe for x64, x86 or ARM
# print(f'Failed to create WindowsLoadTracker: {error}')
self.run_tests()
self.display_result()

View File

@@ -54,6 +54,7 @@ class PlatformTest(unittest.TestCase):
finally:
os.remove(link)
@unittest.skipUnless(sys.platform == 'linux', "TODO: RUSTPYTHON")
def test_platform(self):
for aliased in (False, True):
for terse in (False, True):
@@ -221,6 +222,7 @@ class PlatformTest(unittest.TestCase):
def test_win32_ver(self):
res = platform.win32_ver()
@unittest.skip("TODO: RUSTPYTHON")
def test_mac_ver(self):
res = platform.mac_ver()
@@ -254,6 +256,7 @@ class PlatformTest(unittest.TestCase):
self.assertEqual(res[2], 'PowerPC')
@unittest.skip("TODO: RUSTPYTHON")
@unittest.skipUnless(sys.platform == 'darwin', "OSX only test")
def test_mac_ver_with_fork(self):
# Issue7895: platform.mac_ver() crashes when using fork without exec