commit:     07a32969d5e4a1e81f5e6cee1ec2d0d0e44fedd8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 11:56:18 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 11:57:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07a32969

dev-python/mechanize: Backport a test fix

Closes: https://bugs.gentoo.org/930257
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../mechanize/files/mechanize-0.4.9-test.patch     | 23 ++++++++++++++++++++++
 dev-python/mechanize/mechanize-0.4.9.ebuild        |  9 +++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/dev-python/mechanize/files/mechanize-0.4.9-test.patch 
b/dev-python/mechanize/files/mechanize-0.4.9-test.patch
new file mode 100644
index 000000000000..369cbe9495e1
--- /dev/null
+++ b/dev-python/mechanize/files/mechanize-0.4.9-test.patch
@@ -0,0 +1,23 @@
+From 1324b09b661aaac7d4cdc7e1e9d49e1c3851db2c Mon Sep 17 00:00:00 2001
+From: Martin Weinelt <[email protected]>
+Date: Sun, 21 Apr 2024 13:05:45 +0200
+Subject: [PATCH] Fix test_ftp mime type expectation on 3.11+
+
+Closes: #94
+---
+ test/test_urllib2.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_urllib2.py b/test/test_urllib2.py
+index e9b96fd..c46a2fc 100644
+--- a/test/test_urllib2.py
++++ b/test/test_urllib2.py
+@@ -864,7 +864,7 @@ def connect_ftp(self, user, passwd, host, port, dirs, 
timeout):
+              ["foo", "bar"], _sockettimeout._GLOBAL_DEFAULT_TIMEOUT, "", 
None),
+             ("ftp://localhost/baz.gif;type=a";, "localhost", ftplib.FTP_PORT,
+              "A", [], _sockettimeout._GLOBAL_DEFAULT_TIMEOUT, "baz.gif",
+-             None),  # TODO: really this should guess image/gif
++             "image/gif" if sys.version_info >= (3, 11) else None),
+         ]:
+             req = Request(url, timeout=timeout)
+             r = h.ftp_open(req)

diff --git a/dev-python/mechanize/mechanize-0.4.9.ebuild 
b/dev-python/mechanize/mechanize-0.4.9.ebuild
index 9f450d7fd6b3..801db8146541 100644
--- a/dev-python/mechanize/mechanize-0.4.9.ebuild
+++ b/dev-python/mechanize/mechanize-0.4.9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -29,6 +29,11 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       # https://github.com/python-mechanize/mechanize/pull/95
+       "${FILESDIR}/${P}-test.patch"
+)
+
 python_test() {
-       "${EPYTHON}" run_tests.py || die
+       "${EPYTHON}" run_tests.py -v || die
 }

Reply via email to