From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/
Date: Wed, 28 Feb 2024 06:26:08 +0000 (UTC) [thread overview]
Message-ID: <1709101545.e882b1e956d50808a0143875a8ca35f2fc21f368.zmedico@gentoo> (raw)
commit: e882b1e956d50808a0143875a8ca35f2fc21f368
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 28 06:25:45 2024 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 06:25:45 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e882b1e9
UnshareNetTestCase: Initialize ABILITY_TO_UNSHARE in setUp
Initialize ABILITY_TO_UNSHARE in setUp so that _unshare_validate
uses the correct PORTAGE_MULTIPROCESSING_START_METHOD setup
from super().setUp(), eliminating messages like this from CI
runs for the multiprocessing start method spawn:
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/multiprocessing/popen_fork.py:66:
DeprecationWarning: This process (pid=2886) is multi-threaded, use of fork() may lead to deadlocks in the child.
The cause of these messages can be traced by patching python's
multiprocessing popen_fork.py like this:
--- /usr/lib/python3.12/multiprocessing/popen_fork.py
+++ /usr/lib/python3.12/multiprocessing/popen_fork.py
@@ -2,2 +2,3 @@
import signal
+import traceback
@@ -62,2 +63,3 @@
def _launch(self, process_obj):
+ traceback.print_stack()
code = 1
Fixes: 3110ec376cbc ("actions: Fix interaction between start-method and pytest-xdist")
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/tests/process/test_unshare_net.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/portage/tests/process/test_unshare_net.py b/lib/portage/tests/process/test_unshare_net.py
index dabf15585f..ad3b288ef4 100644
--- a/lib/portage/tests/process/test_unshare_net.py
+++ b/lib/portage/tests/process/test_unshare_net.py
@@ -20,19 +20,27 @@ ping -c 1 -W 1 10.0.0.1 || exit 1
ping -c 1 -W 1 ::1 || exit 1
ping -c 1 -W 1 fd::1 || exit 1
"""
-ABILITY_TO_UNSHARE = portage.process._unshare_validate(CLONE_NEWNET)
class UnshareNetTestCase(TestCase):
- @pytest.mark.skipif(
- ABILITY_TO_UNSHARE != 0,
- reason=f"Unable to unshare: {errno.errorcode.get(ABILITY_TO_UNSHARE, '?')}",
- )
+ def setUp(self):
+ """
+ Initialize ABILITY_TO_UNSHARE in setUp so that _unshare_validate
+ uses the correct PORTAGE_MULTIPROCESSING_START_METHOD setup
+ from super().setUp().
+ """
+ super().setUp()
+ self.ABILITY_TO_UNSHARE = portage.process._unshare_validate(CLONE_NEWNET)
+
@pytest.mark.skipif(
portage.process.find_binary("ping") is None, reason="ping not found"
)
@pytest.mark.skipif(platform.system() != "Linux", reason="not Linux")
def testUnshareNet(self):
+ if self.ABILITY_TO_UNSHARE != 0:
+ pytest.skip(
+ f"Unable to unshare: {errno.errorcode.get(self.ABILITY_TO_UNSHARE, '?')}"
+ )
env = os.environ.copy()
env["IPV6"] = "1" if portage.process._has_ipv6() else ""
self.assertEqual(
next reply other threads:[~2024-02-28 6:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 6:26 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-02-25 0:45 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/ Zac Medico
2024-02-09 7:08 Sam James
2024-02-03 22:54 Zac Medico
2023-11-02 14:57 Zac Medico
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2021-01-18 12:20 Zac Medico
2021-01-18 12:20 Zac Medico
2019-08-31 3:10 Zac Medico
2019-04-14 19:45 Zac Medico
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=1709101545.e882b1e956d50808a0143875a8ca35f2fc21f368.zmedico@gentoo \
--to=zmedico@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