From 92f6cc68200a6219a16116aba9750f06ad204b55 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 4 Apr 2022 09:45:50 +0200 Subject: dev-python/ini2toml: Backport test fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/836619 Signed-off-by: Michał Górny --- dev-python/ini2toml/files/ini2toml-0.10-test.patch | 39 ++++++++++++++++++++++ dev-python/ini2toml/ini2toml-0.10.ebuild | 4 +++ 2 files changed, 43 insertions(+) create mode 100644 dev-python/ini2toml/files/ini2toml-0.10-test.patch (limited to 'dev-python/ini2toml') 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?= +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 -- cgit v1.2.3-65-gdbad