* [gentoo-commits] repo/gentoo:master commit in: dev-python/ujson/files/, dev-python/ujson/
@ 2020-06-12 13:20 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2020-06-12 13:20 UTC (permalink / raw
To: gentoo-commits
commit: 92a03fdd4a0d04f0dc00259b74f2fed4b137a111
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 12 13:20:02 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 12 13:20:19 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92a03fdd
dev-python/ujson: Port to py3.9, fix tests
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
.../ujson/files/ujson-3.0.0-pypy3-test.patch | 80 ++++++++++++++++++++++
dev-python/ujson/ujson-3.0.0.ebuild | 6 +-
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/dev-python/ujson/files/ujson-3.0.0-pypy3-test.patch b/dev-python/ujson/files/ujson-3.0.0-pypy3-test.patch
new file mode 100644
index 00000000000..3bee41bc938
--- /dev/null
+++ b/dev-python/ujson/files/ujson-3.0.0-pypy3-test.patch
@@ -0,0 +1,80 @@
+From c9a5ee46a1112d5f7e51defebeefb1e0ab43111e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 12 Jun 2020 15:04:57 +0200
+Subject: [PATCH 1/3] Do not depend on specific exception messages in tests
+
+Fix test_encode_raises_allow_nan() not to depend on specific exception
+messages. This fixes test failures on PyPy which just happens to use
+different error messages.
+---
+ tests/test_ujson.py | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/tests/test_ujson.py b/tests/test_ujson.py
+index 72018a0..1d41de5 100644
+--- a/tests/test_ujson.py
++++ b/tests/test_ujson.py
+@@ -614,18 +614,17 @@ def test_dumps_raises(test_input, expected_exception, expected_message):
+
+
+ @pytest.mark.parametrize(
+- "test_input, expected_exception, expected_message",
++ "test_input, expected_exception",
+ [
+- (float("nan"), OverflowError, "Invalid value when encoding double"),
+- (float("inf"), OverflowError, "Invalid value when encoding double"),
+- (-float("inf"), OverflowError, "Invalid value when encoding double"),
+- (12839128391289382193812939, OverflowError, "int too big to convert"),
++ (float("nan"), OverflowError),
++ (float("inf"), OverflowError),
++ (-float("inf"), OverflowError),
++ (12839128391289382193812939, OverflowError),
+ ],
+ )
+-def test_encode_raises_allow_nan(test_input, expected_exception, expected_message):
++def test_encode_raises_allow_nan(test_input, expected_exception):
+ with pytest.raises(expected_exception) as e:
+ ujson.dumps(test_input, allow_nan=False)
+- assert str(e.value) == expected_message
+
+
+ @pytest.mark.parametrize(
+--
+2.27.0
+
+From 66cc0ad8a76d1bef848e36d9bdcaf476047b5605 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 12 Jun 2020 15:08:27 +0200
+Subject: [PATCH 2/3] Skip GC tests on PyPy
+
+---
+ tests/test_ujson.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/tests/test_ujson.py b/tests/test_ujson.py
+index 1d41de5..fe20174 100644
+--- a/tests/test_ujson.py
++++ b/tests/test_ujson.py
+@@ -215,6 +215,9 @@ def test_encode_dict_conversion():
+ assert test_input == ujson.decode(output)
+
+
++@pytest.mark.skipif(
++ hasattr(sys, "pypy_version_info"), reason="PyPy uses incompatible GC"
++)
+ def test_encode_dict_values_ref_counting():
+ import gc
+
+@@ -226,6 +229,9 @@ def test_encode_dict_values_ref_counting():
+ assert ref_count == sys.getrefcount(value)
+
+
++@pytest.mark.skipif(
++ hasattr(sys, "pypy_version_info"), reason="PyPy uses incompatible GC"
++)
+ def test_encode_dict_key_ref_counting():
+ import gc
+
+--
+2.27.0
+
diff --git a/dev-python/ujson/ujson-3.0.0.ebuild b/dev-python/ujson/ujson-3.0.0.ebuild
index 5679fb2c3fc..60a87e3a088 100644
--- a/dev-python/ujson/ujson-3.0.0.ebuild
+++ b/dev-python/ujson/ujson-3.0.0.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=7
-PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
inherit distutils-r1
@@ -22,3 +22,7 @@ DEPEND="
"
distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-pypy3-test.patch
+)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-12 13:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-12 13:20 [gentoo-commits] repo/gentoo:master commit in: dev-python/ujson/files/, dev-python/ujson/ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox