public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/fakeredis/files/, dev-python/fakeredis/
@ 2025-03-09 14:58 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2025-03-09 14:58 UTC (permalink / raw
  To: gentoo-commits

commit:     8e5f051fd9b89514c291456b96e7a5ed553bf162
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  9 14:46:02 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar  9 14:58:20 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e5f051f

dev-python/fakeredis: Enable pypy3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/fakeredis/fakeredis-2.27.0.ebuild       |  7 +++++-
 .../fakeredis/files/fakeredis-2.27.0-pypy.patch    | 29 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/dev-python/fakeredis/fakeredis-2.27.0.ebuild b/dev-python/fakeredis/fakeredis-2.27.0.ebuild
index 9eb948a30eb2..1921f6909742 100644
--- a/dev-python/fakeredis/fakeredis-2.27.0.ebuild
+++ b/dev-python/fakeredis/fakeredis-2.27.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=poetry
-PYTHON_COMPAT=( pypy3 python3_{10..13} )
+PYTHON_COMPAT=( pypy3 pypy3_11 python3_{10..13} )
 
 inherit distutils-r1 pypi
 
@@ -38,6 +38,11 @@ BDEPEND="
 distutils_enable_tests pytest
 
 src_prepare() {
+	local PATCHES=(
+		# https://github.com/cunla/fakeredis-py/pull/363
+		"${FILESDIR}/${P}-pypy.patch"
+	)
+
 	distutils-r1_src_prepare
 
 	# https://github.com/cunla/fakeredis-py/issues/320

diff --git a/dev-python/fakeredis/files/fakeredis-2.27.0-pypy.patch b/dev-python/fakeredis/files/fakeredis-2.27.0-pypy.patch
new file mode 100644
index 000000000000..72871a55f59f
--- /dev/null
+++ b/dev-python/fakeredis/files/fakeredis-2.27.0-pypy.patch
@@ -0,0 +1,29 @@
+From 61fef9d6c144f34654bfaa596678696b0d78d229 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 9 Mar 2025 15:36:45 +0100
+Subject: [PATCH] fix: Fix `test_tcp_server_started` to close the connection
+
+Fix `test_tcp_server_started` to use a context manager, in order to
+close the connection to the `TcpFakeServer` when done.  Otherwise,
+the test relies on GC closing the connection in order for the server
+thread to finish -- which does not happen with PyPy, and causes `pytest`
+to hang after running the test suite.
+---
+ test/test_tcp_server/test_connectivity.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/test/test_tcp_server/test_connectivity.py b/test/test_tcp_server/test_connectivity.py
+index 414ed58..9a1f6f1 100644
+--- a/test/test_tcp_server/test_connectivity.py
++++ b/test/test_tcp_server/test_connectivity.py
+@@ -17,7 +17,7 @@ def test_tcp_server_started():
+     t = Thread(target=server.serve_forever, daemon=True)
+     t.start()
+     time.sleep(0.1)
+-    r = redis.Redis(host=server_address[0], port=server_address[1])
+-    r.set("foo", "bar")
+-    assert r.get("foo") == b"bar"
++    with redis.Redis(host=server_address[0], port=server_address[1]) as r:
++        r.set("foo", "bar")
++        assert r.get("foo") == b"bar"
+     server.shutdown()


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-09 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-09 14:58 [gentoo-commits] repo/gentoo:master commit in: dev-python/fakeredis/files/, dev-python/fakeredis/ 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