mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-20 12:33:40 -04:00
dev-python/mcp: fix TOCTOU port collision in tests
Attempt a blind fix for a collision during port assignment in parallel tests. Problematic tests are grouped, forcing them to run sequentially. Closes: https://bugs.gentoo.org/979158 Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
@@ -51,15 +51,34 @@ EPYTEST_PLUGINS=( anyio inline-snapshot )
|
||||
EPYTEST_XDIST=1
|
||||
distutils_enable_tests pytest
|
||||
|
||||
EPYTEST_IGNORE=(
|
||||
# Requires dev-python/pytest-examples which depends on missing Python
|
||||
# bindings in dev-util/ruff::gentoo
|
||||
tests/test_examples.py
|
||||
)
|
||||
EPYTEST_DESELECT=(
|
||||
# Runs dev-python/uv and requires network access (v1.28.1)
|
||||
tests/client/test_config.py::test_command_execution
|
||||
)
|
||||
src_prepare() {
|
||||
distutils-r1_src_prepare
|
||||
|
||||
# Fix TOCTOU port assignment issue
|
||||
# https://bugs.gentoo.org/979158
|
||||
cat >> tests/conftest.py <<-EOF || die
|
||||
|
||||
def pytest_collection_modifyitems(items):
|
||||
for item in items:
|
||||
if hasattr(item.module, "server_port"):
|
||||
item.add_marker(pytest.mark.xdist_group(name="toctou_fix"))
|
||||
EOF
|
||||
}
|
||||
|
||||
python_test() {
|
||||
local EPYTEST_IGNORE=(
|
||||
# Requires dev-python/pytest-examples which depends on missing Python
|
||||
# bindings in dev-util/ruff::gentoo
|
||||
tests/test_examples.py
|
||||
)
|
||||
local EPYTEST_DESELECT=(
|
||||
# Runs dev-python/uv and requires network access (v1.28.1)
|
||||
tests/client/test_config.py::test_command_execution
|
||||
)
|
||||
|
||||
epytest -m "xdist_group" --collect-only
|
||||
epytest --dist=loadgroup
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature "colorized log output" dev-python/rich
|
||||
|
||||
Reference in New Issue
Block a user