From 1e8ea102780db07c38e024773a24f23318cfb907 Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Thu, 6 Feb 2020 22:47:49 +0200 Subject: [PATCH] Allow CPython tests to run on Mac --- Lib/test/libregrtest/main.py | 29 ++++++++++++++++++----------- Lib/test/test_platform.py | 3 +++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index c19ea44db9..f60664d3cc 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -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() diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index f930444322..fde23e09f5 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -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