1 |
commit: fafc85759cc72fafd2b6ce6cd08569dee5268ed4 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 1 07:25:24 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 1 07:25:37 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fafc8575 |
7 |
|
8 |
dev-python/mechanize: enable py3.11 |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
|
12 |
.../mechanize-0.4.8-python3.11-test-order.patch | 79 ++++++++++++++++++++++ |
13 |
dev-python/mechanize/mechanize-0.4.8.ebuild | 6 +- |
14 |
2 files changed, 84 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch b/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch |
17 |
new file mode 100644 |
18 |
index 000000000000..0808460dcc67 |
19 |
--- /dev/null |
20 |
+++ b/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch |
21 |
@@ -0,0 +1,79 @@ |
22 |
+https://github.com/python-mechanize/mechanize/commit/529d2c4cb8f31284f8026642968ba3adb9de1171 |
23 |
+https://github.com/python-mechanize/mechanize/commit/7ba3d586368c03577c061c35bc27664a907f5435 |
24 |
+https://github.com/python-mechanize/mechanize/commit/560839d51e54943890c2d37c0d0854792479cb80 |
25 |
+ |
26 |
+From: Kovid Goyal <kovid@××××××××××.net> |
27 |
+Date: Tue, 24 May 2022 11:13:16 +0530 |
28 |
+Subject: [PATCH] Use asserts for failing test so we get better feedback on the |
29 |
+ failure |
30 |
+ |
31 |
+--- a/test/test_cookies.py |
32 |
++++ b/test/test_cookies.py |
33 |
+@@ -1028,10 +1028,10 @@ def test_Cookie_iterator(self): # noqa |
34 |
+ i = 0 |
35 |
+ for c in cs: |
36 |
+ # assert isinstance(c, Cookie) |
37 |
+- assert c.version == versions[i] |
38 |
+- assert c.name == names[i] |
39 |
+- assert c.domain == domains[i] |
40 |
+- assert c.path == paths[i] |
41 |
++ self.assertEqual(c.version, versions[i]) |
42 |
++ self.assertEqual(c.name, names[i]) |
43 |
++ self.assertEqual(c.domain, domains[i]) |
44 |
++ self.assertEqual(c.path, paths[i]) |
45 |
+ i = i + 1 |
46 |
+ |
47 |
+ self.assertRaises(IndexError, lambda cs=cs: cs[5]) |
48 |
+ |
49 |
+From: Kovid Goyal <kovid@××××××××××.net> |
50 |
+Date: Tue, 24 May 2022 17:54:50 +0530 |
51 |
+Subject: [PATCH] DRYer |
52 |
+ |
53 |
+--- a/test/test_cookies.py |
54 |
++++ b/test/test_cookies.py |
55 |
+@@ -1025,14 +1025,9 @@ def test_Cookie_iterator(self): # noqa |
56 |
+ |
57 |
+ # sequential iteration |
58 |
+ for i in range(4): |
59 |
+- i = 0 |
60 |
+- for c in cs: |
61 |
++ for c, expected in zip(cs, zip(versions, names, domains, paths)): |
62 |
+ # assert isinstance(c, Cookie) |
63 |
+- self.assertEqual(c.version, versions[i]) |
64 |
+- self.assertEqual(c.name, names[i]) |
65 |
+- self.assertEqual(c.domain, domains[i]) |
66 |
+- self.assertEqual(c.path, paths[i]) |
67 |
+- i = i + 1 |
68 |
++ self.assertEqual((c.version, c.name, c.domain, c.path), expected) |
69 |
+ |
70 |
+ self.assertRaises(IndexError, lambda cs=cs: cs[5]) |
71 |
+ |
72 |
+Date: Tue, 24 May 2022 18:09:16 +0530 |
73 |
+Subject: [PATCH] Change test to not rely on order of cookie iteration |
74 |
+ |
75 |
+python 3.11 iterates in add order, earlier pythons iterate in domain |
76 |
+sorted order |
77 |
+ |
78 |
+Fix #74 |
79 |
+--- a/test/test_cookies.py |
80 |
++++ b/test/test_cookies.py |
81 |
+@@ -1022,13 +1022,12 @@ def test_Cookie_iterator(self): # noqa |
82 |
+ "www.acme.com" |
83 |
+ ] |
84 |
+ paths = ["/", "/", "/", "/blah", "/blah/"] |
85 |
+- |
86 |
++ expected = set(zip(versions, names, domains, paths)) |
87 |
+ # sequential iteration |
88 |
+- for i in range(4): |
89 |
+- for c, expected in zip(cs, zip(versions, names, domains, paths)): |
90 |
+- # assert isinstance(c, Cookie) |
91 |
+- self.assertEqual((c.version, c.name, c.domain, c.path), expected) |
92 |
+- |
93 |
++ # python 3.11 iterates in add order, earlier pythons iterate in domain |
94 |
++ # sorted order |
95 |
++ actual = {(c.version, c.name, c.domain, c.path) for c in cs} |
96 |
++ self.assertEqual(expected, actual) |
97 |
+ self.assertRaises(IndexError, lambda cs=cs: cs[5]) |
98 |
+ |
99 |
+ def test_parse_ns_headers(self): |
100 |
+ |
101 |
|
102 |
diff --git a/dev-python/mechanize/mechanize-0.4.8.ebuild b/dev-python/mechanize/mechanize-0.4.8.ebuild |
103 |
index c8d729b6ea5e..327456a039dd 100644 |
104 |
--- a/dev-python/mechanize/mechanize-0.4.8.ebuild |
105 |
+++ b/dev-python/mechanize/mechanize-0.4.8.ebuild |
106 |
@@ -4,7 +4,7 @@ |
107 |
EAPI=8 |
108 |
|
109 |
DISTUTILS_USE_PEP517=setuptools |
110 |
-PYTHON_COMPAT=( python3_{8..10} ) |
111 |
+PYTHON_COMPAT=( python3_{8..11} ) |
112 |
inherit distutils-r1 |
113 |
|
114 |
DESCRIPTION="Stateful programmatic web browsing in Python" |
115 |
@@ -24,6 +24,10 @@ BDEPEND=" |
116 |
) |
117 |
" |
118 |
|
119 |
+PATCHES=( |
120 |
+ "${FILESDIR}"/${PN}-0.4.8-python3.11-test-order.patch |
121 |
+) |
122 |
+ |
123 |
python_test() { |
124 |
"${EPYTHON}" run_tests.py || die |
125 |
} |