1 |
commit: 92f6cc68200a6219a16116aba9750f06ad204b55 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 4 07:45:50 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 4 14:51:25 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92f6cc68 |
7 |
|
8 |
dev-python/ini2toml: Backport test fix |
9 |
|
10 |
Closes: https://bugs.gentoo.org/836619 |
11 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
12 |
|
13 |
dev-python/ini2toml/files/ini2toml-0.10-test.patch | 39 ++++++++++++++++++++++ |
14 |
dev-python/ini2toml/ini2toml-0.10.ebuild | 4 +++ |
15 |
2 files changed, 43 insertions(+) |
16 |
|
17 |
diff --git a/dev-python/ini2toml/files/ini2toml-0.10-test.patch b/dev-python/ini2toml/files/ini2toml-0.10-test.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..bd1d8b093a33 |
20 |
--- /dev/null |
21 |
+++ b/dev-python/ini2toml/files/ini2toml-0.10-test.patch |
22 |
@@ -0,0 +1,39 @@ |
23 |
+From 1a40d273d6671657ef10081123a675bd22e4bf06 Mon Sep 17 00:00:00 2001 |
24 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
25 |
+Date: Sat, 2 Apr 2022 18:21:39 +0200 |
26 |
+Subject: [PATCH] Support duplicate plugin instances in |
27 |
+ test_list_from_entry_points |
28 |
+MIME-Version: 1.0 |
29 |
+Content-Type: text/plain; charset=UTF-8 |
30 |
+Content-Transfer-Encoding: 8bit |
31 |
+ |
32 |
+Account for the possibility of the isort plugin occurring more than |
33 |
+once in the plugin list, in test_list_from_entry_points. This is needed |
34 |
+to avoid test failures on Gentoo where tests are run in a venv |
35 |
+with --system-site-packages. As a result, if ini2toml is installed |
36 |
+already, it grabs all plugins twice — once from the venv, and then again |
37 |
+from system site-packages directory. |
38 |
+--- |
39 |
+ AUTHORS.rst | 1 + |
40 |
+ tests/test_plugins.py | 3 ++- |
41 |
+ 2 files changed, 3 insertions(+), 1 deletion(-) |
42 |
+ |
43 |
+diff --git a/tests/test_plugins.py b/tests/test_plugins.py |
44 |
+index a1e96eb..9b52432 100644 |
45 |
+--- a/tests/test_plugins.py |
46 |
++++ b/tests/test_plugins.py |
47 |
+@@ -46,6 +46,7 @@ def test_list_from_entry_points(): |
48 |
+ # Should return a list with all the plugins registered in the entrypoints |
49 |
+ pluging_list = plugins.list_from_entry_points() |
50 |
+ orig_len = len(pluging_list) |
51 |
++ isort_count = len([e for e in pluging_list if "isort" in str(e.__module__)]) |
52 |
+ assert all(callable(e) for e in pluging_list) |
53 |
+ plugin_names = " ".join(str(e.__module__) for e in pluging_list) |
54 |
+ for example in EXISTING: |
55 |
+@@ -54,5 +55,5 @@ def test_list_from_entry_points(): |
56 |
+ # a filtering function can be passed to avoid loading plugins that are not needed |
57 |
+ pluging_list = plugins.list_from_entry_points(filtering=lambda e: e.name != "isort") |
58 |
+ plugin_names = " ".join(str(e.__module__) for e in pluging_list) |
59 |
+- assert len(pluging_list) == orig_len - 1 |
60 |
++ assert len(pluging_list) == orig_len - isort_count |
61 |
+ assert "isort" not in plugin_names |
62 |
|
63 |
diff --git a/dev-python/ini2toml/ini2toml-0.10.ebuild b/dev-python/ini2toml/ini2toml-0.10.ebuild |
64 |
index 84086969dca7..d855885d7eef 100644 |
65 |
--- a/dev-python/ini2toml/ini2toml-0.10.ebuild |
66 |
+++ b/dev-python/ini2toml/ini2toml-0.10.ebuild |
67 |
@@ -38,6 +38,10 @@ distutils_enable_tests pytest |
68 |
|
69 |
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} |
70 |
|
71 |
+PATCHES=( |
72 |
+ "${FILESDIR}"/${P}-test.patch |
73 |
+) |
74 |
+ |
75 |
EPYTEST_DESELECT=( |
76 |
# pyproject_fmt is not packaged |
77 |
tests/test_cli.py::test_auto_formatting |