Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pytest-salt-factories/files/, dev-python/pytest-salt-factories/
Date: Thu, 31 Mar 2022 02:03:35
Message-Id: 1648692186.120be08f598da8aea6f84ae1822d5bef0bf3cecc.chutzpah@gentoo
1 commit: 120be08f598da8aea6f84ae1822d5bef0bf3cecc
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 31 01:38:56 2022 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 31 02:03:06 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=120be08f
7
8 Revert "dev-python/pytest-salt-factories: Remove old"
9
10 This reverts commit 56cf1d56651bdd2b8e952fdc890463312ac2ca16.
11 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
12
13 dev-python/pytest-salt-factories/Manifest | 1 +
14 .../pytest-salt-factories-0.121.1-tests.patch | 294 +++++++++++++++++++++
15 .../pytest-salt-factories-0.121.1-r1.ebuild | 63 +++++
16 3 files changed, 358 insertions(+)
17
18 diff --git a/dev-python/pytest-salt-factories/Manifest b/dev-python/pytest-salt-factories/Manifest
19 index b2955ea369a7..05d7a46c3fb7 100644
20 --- a/dev-python/pytest-salt-factories/Manifest
21 +++ b/dev-python/pytest-salt-factories/Manifest
22 @@ -1,2 +1,3 @@
23 +DIST pytest-salt-factories-0.121.1.tar.gz 102121 BLAKE2B 92cd5953b11377f1646f01b86a677a50216d16bcb944235a3f04176aecbb005974c415adcbf23cc391aab41b1ee9596984516ab61ecdd8c944d4ce707c39ab00 SHA512 32252695c6e8b17ef17d3330c4b0b38bdce89201d5573b4efa3531a72e826ee1fb26fea3ad0408401dec867cee405f21031804c32eb8fe6ceaa00925b17725a1
24 DIST pytest-salt-factories-0.911.0.tar.gz 161682 BLAKE2B b5a827c9a9acc55c53bc4152b648f96845f513e2d1c8425cbde0862909996a653df4debbf798a3d7461da4fc221acd5fc8e6052e123f3e64e0c8f4345557f141 SHA512 bada21cfe990ccb10b0e298cb05a7f3842d0fe24e2c8664352ae991363d0094dd1ff877adea5fcc0c1040e3f20f82ba616607c595511cade93ebadddd336a26b
25 DIST pytest-salt-factories-1.0.0_rc13.tar.gz 148418 BLAKE2B 3688f05d137df23266ebc7e999bc3b3a8ec198173b38dc98bd4a1e2655b982a37485278691e970da0be700cee6f609c57933b041a6d8403e75fb197f5d23d5d4 SHA512 f3713410704540ee48b7263973d3a9bf3159fb63e53e5ef5002201aea3fdcf0b4eaf00e1dd1e67d869b42242985d8117a117568d63abf5ad366e247fb3e1d83f
26
27 diff --git a/dev-python/pytest-salt-factories/files/pytest-salt-factories-0.121.1-tests.patch b/dev-python/pytest-salt-factories/files/pytest-salt-factories-0.121.1-tests.patch
28 new file mode 100644
29 index 000000000000..3e85580c9158
30 --- /dev/null
31 +++ b/dev-python/pytest-salt-factories/files/pytest-salt-factories-0.121.1-tests.patch
32 @@ -0,0 +1,294 @@
33 +diff --git a/saltfactories/plugin.py b/saltfactories/plugin.py
34 +index b29a115..9d68c34 100644
35 +--- a/saltfactories/plugin.py
36 ++++ b/saltfactories/plugin.py
37 +@@ -21,7 +21,7 @@ def pytest_tempdir_temproot():
38 + tempdir = os.environ.get("TMPDIR") or tempfile.gettempdir()
39 + else:
40 + tempdir = "/tmp"
41 +- return os.path.abspath(os.path.realpath(tempdir))
42 ++ return os.path.abspath(tempdir)
43 +
44 +
45 + def pytest_tempdir_basename():
46 +diff --git a/tests/functional/markers/test_requires_network.py b/tests/functional/markers/test_requires_network.py
47 +index 8b57368..d58f0a1 100644
48 +--- a/tests/functional/markers/test_requires_network.py
49 ++++ b/tests/functional/markers/test_requires_network.py
50 +@@ -9,7 +9,10 @@ from unittest import mock
51 + from saltfactories.utils import ports
52 + from saltfactories.utils import socket
53 +
54 ++import pytest
55 +
56 ++
57 ++@×××××××××××.skip("not compatible with network-sandbox")
58 + def test_has_local_network(testdir):
59 + testdir.makepyfile(
60 + """
61 +diff --git a/tests/integration/factories/cli/test_salt.py b/tests/integration/factories/cli/test_salt.py
62 +index 17fce6c..7bd2789 100644
63 +--- a/tests/integration/factories/cli/test_salt.py
64 ++++ b/tests/integration/factories/cli/test_salt.py
65 +@@ -17,6 +17,7 @@ def salt_minion_2(salt_master, salt_minion):
66 + yield factory
67 +
68 +
69 ++@×××××××××××.skip("not compatible with network-sandbox")
70 + def test_merged_json_out(salt_cli, salt_minion, salt_minion_2):
71 + ret = salt_cli.run("test.ping", minion_tgt="*")
72 + assert ret.exitcode == 0, ret
73 +@@ -27,6 +28,7 @@ def test_merged_json_out(salt_cli, salt_minion, salt_minion_2):
74 + assert ret.json[salt_minion_2.id] is True
75 +
76 +
77 ++@×××××××××××.skip("not compatible with network-sandbox")
78 + def test_merged_json_out_disabled(salt_cli, salt_minion, salt_minion_2):
79 + ret = salt_cli.run("test.ping", minion_tgt="*", merge_json_output=False)
80 + assert ret.exitcode == 0, ret
81 +diff --git a/tests/integration/factories/daemons/api/test_api.py b/tests/integration/factories/daemons/api/test_api.py
82 +index 78b8bb7..e20f28c 100644
83 +--- a/tests/integration/factories/daemons/api/test_api.py
84 ++++ b/tests/integration/factories/daemons/api/test_api.py
85 +@@ -23,5 +23,6 @@ def salt_api(master):
86 + yield factory
87 +
88 +
89 ++@×××××××××××.skip("not compatible with network-sandbox")
90 + def test_api(salt_api):
91 + assert salt_api.is_running()
92 +diff --git a/tests/integration/factories/daemons/api/test_restarts.py b/tests/integration/factories/daemons/api/test_restarts.py
93 +index a6c5472..dd15c17 100644
94 +--- a/tests/integration/factories/daemons/api/test_restarts.py
95 ++++ b/tests/integration/factories/daemons/api/test_restarts.py
96 +@@ -16,6 +16,7 @@ def master(salt_factories):
97 + yield factory
98 +
99 +
100 ++@×××××××××××.skip("not compatible with network-sandbox")
101 + def test_multiple_start_stops(master):
102 + factory = master.get_salt_api_daemon()
103 + assert factory.is_running() is False
104 +diff --git a/tests/integration/factories/daemons/master/test_master.py b/tests/integration/factories/daemons/master/test_master.py
105 +index 2676dfa..cbf598e 100644
106 +--- a/tests/integration/factories/daemons/master/test_master.py
107 ++++ b/tests/integration/factories/daemons/master/test_master.py
108 +@@ -46,10 +46,12 @@ def salt_key(master):
109 + return master.get_salt_key_cli()
110 +
111 +
112 ++@×××××××××××.skip("not compatible with network-sandbox")
113 + def test_master(master):
114 + assert master.is_running()
115 +
116 +
117 ++@×××××××××××.skip("not compatible with network-sandbox")
118 + def test_salt_run(master, salt_run):
119 + max_open_files_config_value = master.config["max_open_files"]
120 + ret = salt_run.run("config.get", "max_open_files")
121 +@@ -57,6 +59,7 @@ def test_salt_run(master, salt_run):
122 + assert ret.json == max_open_files_config_value
123 +
124 +
125 ++@×××××××××××.skip("not compatible with network-sandbox")
126 + def test_salt_cp(master, minion, salt_cp, tempfiles):
127 + """
128 + Test copying a file from the master to the minion
129 +@@ -98,6 +101,7 @@ def test_salt_cp(master, minion, salt_cp, tempfiles):
130 + os.unlink(dest)
131 +
132 +
133 ++@×××××××××××.skip("not compatible with network-sandbox")
134 + def test_salt_cp_no_match(master, minion, salt_cp, tempfiles):
135 + assert master.is_running()
136 + assert minion.is_running()
137 +@@ -119,6 +123,7 @@ def test_salt_cp_no_match(master, minion, salt_cp, tempfiles):
138 + os.unlink(dest)
139 +
140 +
141 ++@×××××××××××.skip("not compatible with sandbox")
142 + @pytest.mark.skip_on_salt_system_install
143 + def test_salt_key(master, minion, minion_3, salt_key):
144 + ret = salt_key.run("--list-all")
145 +diff --git a/tests/integration/factories/daemons/master/test_restarts.py b/tests/integration/factories/daemons/master/test_restarts.py
146 +index 6a6852d..70415d0 100644
147 +--- a/tests/integration/factories/daemons/master/test_restarts.py
148 ++++ b/tests/integration/factories/daemons/master/test_restarts.py
149 +@@ -11,6 +11,7 @@ def master(salt_factories):
150 + return factory
151 +
152 +
153 ++@×××××××××××.skip("not compatible with network")
154 + def test_multiple_start_stops(master):
155 + assert master.is_running() is False
156 + pid = None
157 +diff --git a/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py b/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
158 +index d63e640..653693e 100644
159 +--- a/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
160 ++++ b/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
161 +@@ -28,6 +28,7 @@ def salt_call_cli(minion):
162 + return minion.get_salt_call_cli()
163 +
164 +
165 ++@×××××××××××.skip("not compatible with network-sandbox")
166 + def test_event_listener_engine(minion, salt_call_cli, event_listener):
167 + """
168 + There are some events which the minion fires internally that never reach the master.
169 +diff --git a/tests/integration/factories/daemons/minion/test_minion.py b/tests/integration/factories/daemons/minion/test_minion.py
170 +index 64a3df6..ab82e55 100644
171 +--- a/tests/integration/factories/daemons/minion/test_minion.py
172 ++++ b/tests/integration/factories/daemons/minion/test_minion.py
173 +@@ -27,6 +27,7 @@ def salt_call_cli(minion):
174 + return minion.get_salt_call_cli()
175 +
176 +
177 ++@×××××××××××.skip("not compatible with network-sandbox")
178 + def test_minion(minion, salt_cli):
179 + assert minion.is_running()
180 + ret = salt_cli.run("test.ping", minion_tgt=minion.id)
181 +@@ -34,6 +35,7 @@ def test_minion(minion, salt_cli):
182 + assert ret.json is True
183 +
184 +
185 ++@×××××××××××.skip("not compatible with network-sandbox")
186 + def test_no_match(minion, salt_cli):
187 + assert minion.is_running()
188 + ret = salt_cli.run("test.ping", minion_tgt="minion-2")
189 +@@ -41,6 +43,7 @@ def test_no_match(minion, salt_cli):
190 + assert not ret.json
191 +
192 +
193 ++@×××××××××××.skip("not compatible with network-sandbox")
194 + def test_show_jid(minion, salt_cli):
195 + assert minion.is_running()
196 + ret = salt_cli.run("--show-jid", "test.ping", minion_tgt=minion.id)
197 +@@ -48,6 +51,7 @@ def test_show_jid(minion, salt_cli):
198 + assert ret.json is True
199 +
200 +
201 ++@×××××××××××.skip("not compatible with network-sandbox")
202 + def test_minion_salt_call(minion, salt_call_cli):
203 + assert minion.is_running()
204 + ret = salt_call_cli.run("test.ping")
205 +@@ -59,6 +63,7 @@ def test_minion_salt_call(minion, salt_call_cli):
206 + assert ret.json is True
207 +
208 +
209 ++@×××××××××××.skip("not compatible with network-sandbox")
210 + def test_salt_call_exception_handling_doesnt_timeout(minion, salt_call_cli):
211 + ret = salt_call_cli.run(
212 + "test.raise_exception", "OSError", "2", "No such file or directory", "/tmp/foo.txt"
213 +diff --git a/tests/integration/factories/daemons/minion/test_restarts.py b/tests/integration/factories/daemons/minion/test_restarts.py
214 +index a7d9ae0..8f0401b 100644
215 +--- a/tests/integration/factories/daemons/minion/test_restarts.py
216 ++++ b/tests/integration/factories/daemons/minion/test_restarts.py
217 +@@ -10,6 +10,7 @@ def master(salt_factories):
218 + yield factory
219 +
220 +
221 ++@×××××××××××.skip("not compatible with network-sandbox")
222 + def test_multiple_start_stops(master):
223 + factory = master.get_salt_minion_daemon(random_string("minion-"))
224 + assert factory.is_running() is False
225 +diff --git a/tests/integration/factories/daemons/proxy/test_proxy_minion.py b/tests/integration/factories/daemons/proxy/test_proxy_minion.py
226 +index 3bbca21..2e2fb8b 100644
227 +--- a/tests/integration/factories/daemons/proxy/test_proxy_minion.py
228 ++++ b/tests/integration/factories/daemons/proxy/test_proxy_minion.py
229 +@@ -35,6 +35,7 @@ def salt_call_cli(proxy_minion):
230 + return proxy_minion.get_salt_call_cli()
231 +
232 +
233 ++@×××××××××××.skip("not compatible with network-sandbox")
234 + def test_proxy_minion(proxy_minion, salt_cli):
235 + assert proxy_minion.is_running()
236 + ret = salt_cli.run("test.ping", minion_tgt=proxy_minion.id)
237 +@@ -42,6 +43,7 @@ def test_proxy_minion(proxy_minion, salt_cli):
238 + assert ret.json is True
239 +
240 +
241 ++@×××××××××××.skip("not compatible with network-sandbox")
242 + def test_no_match(proxy_minion, salt_cli):
243 + assert proxy_minion.is_running()
244 + ret = salt_cli.run("test.ping", minion_tgt="proxy-minion-2")
245 +@@ -49,6 +51,7 @@ def test_no_match(proxy_minion, salt_cli):
246 + assert not ret.json
247 +
248 +
249 ++@×××××××××××.skip("not compatible with network-sandbox")
250 + def test_show_jid(proxy_minion, salt_cli):
251 + if platform.is_darwin() and sys.version_info[:2] == (3, 7):
252 + pytest.skip(
253 +@@ -61,6 +64,7 @@ def test_show_jid(proxy_minion, salt_cli):
254 + assert ret.json is True
255 +
256 +
257 ++@×××××××××××.skip("not compatible with network-sandbox")
258 + def test_proxy_minion_salt_call(proxy_minion, salt_call_cli):
259 + assert proxy_minion.is_running()
260 + ret = salt_call_cli.run("test.ping")
261 +diff --git a/tests/integration/factories/daemons/proxy/test_restarts.py b/tests/integration/factories/daemons/proxy/test_restarts.py
262 +index 3101204..28652ff 100644
263 +--- a/tests/integration/factories/daemons/proxy/test_restarts.py
264 ++++ b/tests/integration/factories/daemons/proxy/test_restarts.py
265 +@@ -17,6 +17,7 @@ def master(salt_factories):
266 + yield factory
267 +
268 +
269 ++@×××××××××××.skip("not compatible with sandbox")
270 + def test_multiple_start_stops(master):
271 + factory = master.get_salt_proxy_minion_daemon(random_string("proxy-minion-"))
272 + assert factory.is_running() is False
273 +diff --git a/tests/integration/factories/daemons/ssh/test_salt_ssh.py b/tests/integration/factories/daemons/ssh/test_salt_ssh.py
274 +index f58eac4..c3df3de 100644
275 +--- a/tests/integration/factories/daemons/ssh/test_salt_ssh.py
276 ++++ b/tests/integration/factories/daemons/ssh/test_salt_ssh.py
277 +@@ -51,6 +51,7 @@ def salt_ssh_cli(sshd, salt_factories, master):
278 +
279 +
280 + @pytest.mark.skip_on_windows
281 ++@×××××××××××.skip("not compatible with network-sandbox")
282 + def test_salt_ssh(salt_ssh_cli):
283 + ret = salt_ssh_cli.run("--ignore-host-keys", "test.echo", "It Works!", minion_tgt="localhost")
284 + assert ret.exitcode == 0
285 +diff --git a/tests/integration/factories/daemons/sshd/test_sshd.py b/tests/integration/factories/daemons/sshd/test_sshd.py
286 +index 3b425fc..3e03636 100644
287 +--- a/tests/integration/factories/daemons/sshd/test_sshd.py
288 ++++ b/tests/integration/factories/daemons/sshd/test_sshd.py
289 +@@ -5,6 +5,7 @@ import pytest
290 +
291 + @pytest.fixture(scope="module")
292 + @pytest.mark.skip_if_binaries_missing("sshd", "ssh-keygen")
293 ++@×××××××××××.skip("not compatible with network-sandbox")
294 + def sshd(salt_factories):
295 + # Set StrictModes to no because our config directory lives in /tmp and those permissions
296 + # are not acceptable by sshd strict paranoia.
297 +@@ -15,12 +16,14 @@ def sshd(salt_factories):
298 +
299 +
300 + @pytest.mark.skip_on_windows
301 ++@×××××××××××.skip("not compatible with network-sandbox")
302 + def test_sshd(sshd):
303 + assert sshd.is_running()
304 +
305 +
306 + @pytest.mark.skip_on_windows
307 + @pytest.mark.skip_if_binaries_missing("ssh")
308 ++@×××××××××××.skip("not compatible with network-sandbox")
309 + def test_connect(sshd):
310 + cmd = subprocess.run(
311 + [
312 +diff --git a/tests/unit/utils/markers/test_skip_if_no_remote_network.py b/tests/unit/utils/markers/test_skip_if_no_remote_network.py
313 +index 1aa72dc..c4d079e 100644
314 +--- a/tests/unit/utils/markers/test_skip_if_no_remote_network.py
315 ++++ b/tests/unit/utils/markers/test_skip_if_no_remote_network.py
316 +@@ -9,7 +9,10 @@ from unittest import mock
317 + import saltfactories.utils.markers as markers
318 + from saltfactories.utils import socket
319 +
320 ++import pytest
321 +
322 ++
323 ++@×××××××××××.skip("not compatible with network-sandbox")
324 + def test_has_remote_network():
325 + assert markers.skip_if_no_remote_network() is None
326 +
327
328 diff --git a/dev-python/pytest-salt-factories/pytest-salt-factories-0.121.1-r1.ebuild b/dev-python/pytest-salt-factories/pytest-salt-factories-0.121.1-r1.ebuild
329 new file mode 100644
330 index 000000000000..e4d2f0f1ee31
331 --- /dev/null
332 +++ b/dev-python/pytest-salt-factories/pytest-salt-factories-0.121.1-r1.ebuild
333 @@ -0,0 +1,63 @@
334 +# Copyright 2020-2021 Gentoo Authors
335 +# Distributed under the terms of the GNU General Public License v2
336 +
337 +EAPI=7
338 +
339 +PYTHON_COMPAT=( python3_{7..9} )
340 +inherit distutils-r1
341 +
342 +DESCRIPTION="The new generation of the pytest-salt Plugin"
343 +HOMEPAGE="https://github.com/saltstack/pytest-salt-factories"
344 +SRC_URI="https://github.com/saltstack/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
345 +
346 +LICENSE="Apache-2.0"
347 +SLOT="0"
348 +KEYWORDS="amd64 ~arm ~arm64 x86"
349 +IUSE="test"
350 +
351 +RDEPEND="
352 + >=dev-python/pytest-6.1.1[${PYTHON_USEDEP}]
353 + dev-python/attrs[${PYTHON_USEDEP}]
354 + dev-python/pytest-tempdir[${PYTHON_USEDEP}]
355 + dev-python/psutil[${PYTHON_USEDEP}]
356 + dev-python/pyzmq[${PYTHON_USEDEP}]
357 + dev-python/msgpack[${PYTHON_USEDEP}]
358 + >=app-admin/salt-3001.0[${PYTHON_USEDEP}]
359 +"
360 +BDEPEND="${RDEPEND}"
361 +
362 +PATCHES=(
363 + "${FILESDIR}/pytest-salt-factories-0.121.1-tests.patch"
364 +)
365 +
366 +distutils_enable_tests --install pytest
367 +
368 +python_prepare_all() {
369 + sed -r -e "s:use_scm_version=True:version='${PV}', name='${PN//-/.}':" -i setup.py || die
370 + sed -r -e '/(setuptools|setup_requires)/ d' -i setup.cfg || die
371 +
372 + sed -i 's:tool.setuptools_scm:tool.disabled:' pyproject.toml || die
373 + printf '__version__ = "%s"\n' "${PV}" > saltfactories/version.py || die
374 + distutils-r1_python_prepare_all
375 +}
376 +
377 +python_test() {
378 + local tempdir
379 +
380 + # ${T} is too long a path for the tests to work
381 + tempdir="$(mktemp -du --tmpdir=/tmp salt-XXX)"
382 + mkdir "${T}/$(basename "${tempdir}")"
383 +
384 + addwrite "${tempdir}"
385 + ln -s "$(realpath --relative-to=/tmp "${T}/$(basename "${tempdir}")")" "${tempdir}" || die
386 +
387 + distutils_install_for_testing --via-root
388 +
389 + (
390 + cleanup() { rm -f "${tempdir}" || die; }
391 +
392 + trap cleanup EXIT
393 + SHELL="/bin/bash" TMPDIR="${tempdir}" \
394 + pytest -vv || die "Tests failed with ${EPYTHON}"
395 + )
396 +}