From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/isort/, dev-python/isort/files/
Date: Mon, 6 Nov 2023 13:22:34 +0000 (UTC) [thread overview]
Message-ID: <1699276950.cbf0ba8d926be7101a8d7cbf19cd2061dbc8584c.mgorny@gentoo> (raw)
commit: cbf0ba8d926be7101a8d7cbf19cd2061dbc8584c
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 6 13:07:41 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 6 13:22:30 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbf0ba8d
dev-python/isort: Enable py3.12
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/isort/files/isort-5.12.0-py312.patch | 40 +++++++++++++++++++++++++
dev-python/isort/isort-5.12.0.ebuild | 7 ++++-
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/dev-python/isort/files/isort-5.12.0-py312.patch b/dev-python/isort/files/isort-5.12.0-py312.patch
new file mode 100644
index 000000000000..a6de4a75311b
--- /dev/null
+++ b/dev-python/isort/files/isort-5.12.0-py312.patch
@@ -0,0 +1,40 @@
+From abfb91fd7da34111828d81a20fe7aeaaab7a58c7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 6 Nov 2023 13:29:21 +0100
+Subject: [PATCH] Fix assertions in `test_git_hook`
+
+Fix `called_once()` assertions in `test_git_hook` to use the correct
+`assert_called_once()` method. The former does not exist, so it
+evaluates to a mocked method in Python < 3.12, making the assert
+meaningless, and it triggers an error in Python 3.12+.
+
+While at it, split the mock into two because otherwise the test would
+fail because two `hooks.git_hook()` calls imply two mock calls.
+---
+ tests/unit/test_hooks.py | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tests/unit/test_hooks.py b/tests/unit/test_hooks.py
+index 2757f414f..29685f503 100644
+--- a/tests/unit/test_hooks.py
++++ b/tests/unit/test_hooks.py
+@@ -11,7 +11,7 @@ def test_git_hook(src_dir):
+ # Ensure correct subprocess command is called
+ with patch("subprocess.run", MagicMock()) as run_mock:
+ hooks.git_hook()
+- assert run_mock.called_once()
++ run_mock.assert_called_once()
+ assert run_mock.call_args[0][0] == [
+ "git",
+ "diff-index",
+@@ -21,8 +21,9 @@ def test_git_hook(src_dir):
+ "HEAD",
+ ]
+
++ with patch("subprocess.run", MagicMock()) as run_mock:
+ hooks.git_hook(lazy=True)
+- assert run_mock.called_once()
++ run_mock.assert_called_once()
+ assert run_mock.call_args[0][0] == [
+ "git",
+ "diff-index",
diff --git a/dev-python/isort/isort-5.12.0.ebuild b/dev-python/isort/isort-5.12.0.ebuild
index 6a9a23af7de4..e3f28e100a52 100644
--- a/dev-python/isort/isort-5.12.0.ebuild
+++ b/dev-python/isort/isort-5.12.0.ebuild
@@ -4,7 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517=poetry
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
inherit distutils-r1
@@ -39,6 +39,11 @@ BDEPEND="
distutils_enable_tests pytest
src_prepare() {
+ local PATCHES=(
+ # https://github.com/PyCQA/isort/pull/2196
+ "${FILESDIR}/${P}-py312.patch"
+ )
+
# unbundle tomli
sed -i -e 's:from ._vendored ::' isort/settings.py || die
rm -r isort/_vendored || die
next reply other threads:[~2023-11-06 13:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 13:22 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-12-10 16:15 [gentoo-commits] repo/gentoo:master commit in: dev-python/isort/, dev-python/isort/files/ Michał Górny
2021-02-19 8:35 Michał Górny
2020-12-31 6:39 Sam James
2019-12-06 19:18 Patrick McLean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1699276950.cbf0ba8d926be7101a8d7cbf19cd2061dbc8584c.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox