diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-07-10 07:39:03 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-07-10 07:39:47 +0200 |
commit | 8239792739f7a1f227c950cdc92f8fefefc9e98f (patch) | |
tree | 4aec8f66f9830625338eeabb0f56e15a7d4d7bdc /dev-python/importlib-resources | |
parent | www-apps/hugo: drop virtual/pandoc as a hard test dependency (diff) | |
download | gentoo-8239792739f7a1f227c950cdc92f8fefefc9e98f.tar.gz gentoo-8239792739f7a1f227c950cdc92f8fefefc9e98f.tar.bz2 gentoo-8239792739f7a1f227c950cdc92f8fefefc9e98f.zip |
dev-python/importlib-resources: Fix tests on big endian
Closes: https://bugs.gentoo.org/935804
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/importlib-resources')
-rw-r--r-- | dev-python/importlib-resources/files/importlib-resources-6.4.0-be.patch | 40 | ||||
-rw-r--r-- | dev-python/importlib-resources/importlib-resources-6.4.0.ebuild | 5 |
2 files changed, 45 insertions, 0 deletions
diff --git a/dev-python/importlib-resources/files/importlib-resources-6.4.0-be.patch b/dev-python/importlib-resources/files/importlib-resources-6.4.0-be.patch new file mode 100644 index 000000000000..a4c20249af4f --- /dev/null +++ b/dev-python/importlib-resources/files/importlib-resources-6.4.0-be.patch @@ -0,0 +1,40 @@ +From 3167e4b9de35ea3010d84429b7eafb9a7c2afbb4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 10 Jul 2024 07:33:47 +0200 +Subject: [PATCH] Fix functional API tests to be endian-agnostic + +Fix the "backslashreplace" tests for the functional API to be +endian-agnostic. The tests used to rely on `.encode("utf-16")` +producing the same data as found in the test file. However, on big +endian platforms it would produce a big endian encoding, while the test +file is little endian. To avoid the problem, explicitly specify +`utf-16-le` encoding. Since this meant that the BOM is no longer +produced, explicitly include it in input. + +Fixes #312 +--- + importlib_resources/tests/test_functional.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/importlib_resources/tests/test_functional.py b/importlib_resources/tests/test_functional.py +index 69706cf..255bd13 100644 +--- a/importlib_resources/tests/test_functional.py ++++ b/importlib_resources/tests/test_functional.py +@@ -82,7 +82,7 @@ def test_read_text(self): + 'utf-16.file', + errors='backslashreplace', + ), +- 'Hello, UTF-16 world!\n'.encode('utf-16').decode( ++ '\ufeffHello, UTF-16 world!\n'.encode('utf-16-le').decode( + errors='backslashreplace', + ), + ) +@@ -130,7 +130,7 @@ def test_open_text(self): + ) as f: + self.assertEqual( + f.read(), +- 'Hello, UTF-16 world!\n'.encode('utf-16').decode( ++ '\ufeffHello, UTF-16 world!\n'.encode('utf-16-le').decode( + errors='backslashreplace', + ), + ) diff --git a/dev-python/importlib-resources/importlib-resources-6.4.0.ebuild b/dev-python/importlib-resources/importlib-resources-6.4.0.ebuild index 277d817655e9..a79348c3becd 100644 --- a/dev-python/importlib-resources/importlib-resources-6.4.0.ebuild +++ b/dev-python/importlib-resources/importlib-resources-6.4.0.ebuild @@ -28,3 +28,8 @@ BDEPEND=" " distutils_enable_tests unittest + +PATCHES=( + # https://github.com/python/importlib_resources/pull/313 + "${FILESDIR}/${P}-be.patch" +) |