From 96fef9e36cb9196a8b02e1b6fbd13e2425a6643c Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Sun, 26 Nov 2023 00:49:22 +0000 Subject: [PATCH] All runtime tests passing on x86_64 on both Python 3.12 and 3.8 (closes #967) --- .../src/test/python/chaquopy/test/android/test_import.py | 8 ++------ .../src/test/python/chaquopy/test/android/test_stdlib.py | 8 ++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/product/runtime/src/test/python/chaquopy/test/android/test_import.py b/product/runtime/src/test/python/chaquopy/test/android/test_import.py index 40c7f54377..2c35165118 100644 --- a/product/runtime/src/test/python/chaquopy/test/android/test_import.py +++ b/product/runtime/src/test/python/chaquopy/test/android/test_import.py @@ -16,7 +16,7 @@ from shutil import rmtree import sys from traceback import format_exc -from unittest import expectedFailure, skipIf +from unittest import skipIf import types from warnings import catch_warnings, filterwarnings @@ -52,10 +52,6 @@ class TestAndroidImport(FilterWarningsCase): maxDiff = None - # This will be fixed in Python 3.12.1 (https://github.com/python/cpython/pull/110247) - expectedFailure312 = expectedFailure if sys.version_info >= (3, 12) else lambda x: x - - @expectedFailure312 def test_bootstrap(self): chaquopy_dir = join(str(context.getFilesDir()), "chaquopy") self.assertCountEqual(["AssetFinder", "bootstrap-native", "bootstrap.imy", @@ -75,7 +71,7 @@ def test_bootstrap(self): stdlib_bootstrap_expected |= {"_sha2.so"} for subdir, entries in [ - (ABI, stdlib_bootstrap_expected), + (ABI, list(stdlib_bootstrap_expected)), (f"{ABI}/java", ["chaquopy.so"]), ]: with self.subTest(subdir=subdir): diff --git a/product/runtime/src/test/python/chaquopy/test/android/test_stdlib.py b/product/runtime/src/test/python/chaquopy/test/android/test_stdlib.py index 7280194645..5da608c881 100644 --- a/product/runtime/src/test/python/chaquopy/test/android/test_stdlib.py +++ b/product/runtime/src/test/python/chaquopy/test/android/test_stdlib.py @@ -22,7 +22,9 @@ def test_datetime(self): # imported. self.assertTrue(datetime.datetime_CAPI) - # This will be fixed in Python 3.12.1 (https://github.com/python/cpython/pull/110247) + # hashlib is currently being imported before the importer is ready, causing some + # algorithms to be unavailable. This will be fixed in Python 3.12.1 + # (https://github.com/python/cpython/pull/110247) expectedFailure312 = expectedFailure if sys.version_info >= (3, 12) else lambda x: x @expectedFailure312 @@ -123,7 +125,9 @@ def test_os(self): self.assertTrue(os.access(name, os.X_OK)) for args in [[], [1]]: - with self.assertRaisesRegex(OSError, "Inappropriate ioctl for device"): + with self.assertRaisesRegex( + OSError, r"Inappropriate ioctl for device|Not a typewriter" + ): os.get_terminal_size(*args) def test_pickle(self):