summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-04 09:45:50 +0200
committerMichał Górny <mgorny@gentoo.org>2022-04-04 16:51:25 +0200
commit92f6cc68200a6219a16116aba9750f06ad204b55 (patch)
treede6d69e6ed7015d1969820bf7e91771631778770 /dev-python/ini2toml
parentdev-embedded/xa: add 2.3.13 (diff)
downloadgentoo-92f6cc68200a6219a16116aba9750f06ad204b55.tar.gz
gentoo-92f6cc68200a6219a16116aba9750f06ad204b55.tar.bz2
gentoo-92f6cc68200a6219a16116aba9750f06ad204b55.zip
dev-python/ini2toml: Backport test fix
Closes: https://bugs.gentoo.org/836619 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/ini2toml')
-rw-r--r--dev-python/ini2toml/files/ini2toml-0.10-test.patch39
-rw-r--r--dev-python/ini2toml/ini2toml-0.10.ebuild4
2 files changed, 43 insertions, 0 deletions
diff --git a/dev-python/ini2toml/files/ini2toml-0.10-test.patch b/dev-python/ini2toml/files/ini2toml-0.10-test.patch
new file mode 100644
index 000000000000..bd1d8b093a33
--- /dev/null
+++ b/dev-python/ini2toml/files/ini2toml-0.10-test.patch
@@ -0,0 +1,39 @@
+From 1a40d273d6671657ef10081123a675bd22e4bf06 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 2 Apr 2022 18:21:39 +0200
+Subject: [PATCH] Support duplicate plugin instances in
+ test_list_from_entry_points
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Account for the possibility of the isort plugin occurring more than
+once in the plugin list, in test_list_from_entry_points. This is needed
+to avoid test failures on Gentoo where tests are run in a venv
+with --system-site-packages. As a result, if ini2toml is installed
+already, it grabs all plugins twice — once from the venv, and then again
+from system site-packages directory.
+---
+ AUTHORS.rst | 1 +
+ tests/test_plugins.py | 3 ++-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_plugins.py b/tests/test_plugins.py
+index a1e96eb..9b52432 100644
+--- a/tests/test_plugins.py
++++ b/tests/test_plugins.py
+@@ -46,6 +46,7 @@ def test_list_from_entry_points():
+ # Should return a list with all the plugins registered in the entrypoints
+ pluging_list = plugins.list_from_entry_points()
+ orig_len = len(pluging_list)
++ isort_count = len([e for e in pluging_list if "isort" in str(e.__module__)])
+ assert all(callable(e) for e in pluging_list)
+ plugin_names = " ".join(str(e.__module__) for e in pluging_list)
+ for example in EXISTING:
+@@ -54,5 +55,5 @@ def test_list_from_entry_points():
+ # a filtering function can be passed to avoid loading plugins that are not needed
+ pluging_list = plugins.list_from_entry_points(filtering=lambda e: e.name != "isort")
+ plugin_names = " ".join(str(e.__module__) for e in pluging_list)
+- assert len(pluging_list) == orig_len - 1
++ assert len(pluging_list) == orig_len - isort_count
+ assert "isort" not in plugin_names
diff --git a/dev-python/ini2toml/ini2toml-0.10.ebuild b/dev-python/ini2toml/ini2toml-0.10.ebuild
index 84086969dca7..d855885d7eef 100644
--- a/dev-python/ini2toml/ini2toml-0.10.ebuild
+++ b/dev-python/ini2toml/ini2toml-0.10.ebuild
@@ -38,6 +38,10 @@ distutils_enable_tests pytest
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
+PATCHES=(
+ "${FILESDIR}"/${P}-test.patch
+)
+
EPYTEST_DESELECT=(
# pyproject_fmt is not packaged
tests/test_cli.py::test_auto_formatting