* [gentoo-dev] [PATCH 1/3] python-utils-r1.eclass: Do not pass `-p xdist` w/ PYTEST_PLUGINS
@ 2023-11-18 16:52 Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 2/3] python-utils-r1.eclass: Do not pass `-p no:*` w/ no autoloading Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Silence pydevd warnings Michał Górny
0 siblings, 2 replies; 3+ messages in thread
From: Michał Górny @ 2023-11-18 16:52 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Fix `epytest` with `EPYTEST_XDIST` not to pass a duplicate `-p xdist`
when `xdist.plugin` is already present in `PYTEST_PLUGINS`. Otherwise,
pytest will fail due to the plugin being loaded twice.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-utils-r1.eclass | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 80abe974f9df..1de4f325de33 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1390,10 +1390,14 @@ epytest() {
if [[ ${EPYTEST_XDIST} ]]; then
local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
if [[ ${jobs} -gt 1 ]]; then
+ if [[ ${PYTEST_PLUGINS} != *xdist.plugin* ]]; then
+ args+=(
+ # explicitly enable the plugin, in case the ebuild was
+ # using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ -p xdist
+ )
+ fi
args+=(
- # explicitly enable the plugin, in case the ebuild was using
- # PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
- -p xdist
-n "${jobs}"
# worksteal ensures that workers don't end up idle when heavy
# jobs are unevenly distributed
--
2.42.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH 2/3] python-utils-r1.eclass: Do not pass `-p no:*` w/ no autoloading
2023-11-18 16:52 [gentoo-dev] [PATCH 1/3] python-utils-r1.eclass: Do not pass `-p xdist` w/ PYTEST_PLUGINS Michał Górny
@ 2023-11-18 16:52 ` Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Silence pydevd warnings Michał Górny
1 sibling, 0 replies; 3+ messages in thread
From: Michał Górny @ 2023-11-18 16:52 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Modify `epytest` not to pass our plethora of `-p no:*` arguments
when `PYTEST_DISABLE_PLUGIN_AUTOLOAD` is set. This is NFC since
the plugins wouldn't be loaded anyway.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-utils-r1.eclass | 51 +++++++++++++++++++----------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 1de4f325de33..394f64a5d139 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1362,31 +1362,36 @@ epytest() {
# count is more precise when we're dealing with a large number
# of tests
-o console_output_style=count
- # disable the undesirable-dependency plugins by default to
- # trigger missing argument strips. strip options that require
- # them from config files. enable them explicitly via "-p ..."
- # if you *really* need them.
- -p no:cov
- -p no:flake8
- -p no:flakes
- -p no:pylint
- # sterilize pytest-markdown as it runs code snippets from all
- # *.md files found without any warning
- -p no:markdown
- # pytest-sugar undoes everything that's good about pytest output
- # and makes it hard to read logs
- -p no:sugar
- # pytest-xvfb automatically spawns Xvfb for every test suite,
- # effectively forcing it even when we'd prefer the tests
- # not to have DISPLAY at all, causing crashes sometimes
- # and causing us to miss missing virtualx usage
- -p no:xvfb
- # intrusive packages that break random test suites
- -p no:pytest-describe
- -p no:plus
- -p no:tavern
)
+ if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then
+ args+=(
+ # disable the undesirable-dependency plugins by default to
+ # trigger missing argument strips. strip options that require
+ # them from config files. enable them explicitly via "-p ..."
+ # if you *really* need them.
+ -p no:cov
+ -p no:flake8
+ -p no:flakes
+ -p no:pylint
+ # sterilize pytest-markdown as it runs code snippets from all
+ # *.md files found without any warning
+ -p no:markdown
+ # pytest-sugar undoes everything that's good about pytest output
+ # and makes it hard to read logs
+ -p no:sugar
+ # pytest-xvfb automatically spawns Xvfb for every test suite,
+ # effectively forcing it even when we'd prefer the tests
+ # not to have DISPLAY at all, causing crashes sometimes
+ # and causing us to miss missing virtualx usage
+ -p no:xvfb
+ # intrusive packages that break random test suites
+ -p no:pytest-describe
+ -p no:plus
+ -p no:tavern
+ )
+ fi
+
if [[ ${EPYTEST_XDIST} ]]; then
local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
if [[ ${jobs} -gt 1 ]]; then
--
2.42.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Silence pydevd warnings
2023-11-18 16:52 [gentoo-dev] [PATCH 1/3] python-utils-r1.eclass: Do not pass `-p xdist` w/ PYTEST_PLUGINS Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 2/3] python-utils-r1.eclass: Do not pass `-p no:*` w/ no autoloading Michał Górny
@ 2023-11-18 16:52 ` Michał Górny
1 sibling, 0 replies; 3+ messages in thread
From: Michał Górny @ 2023-11-18 16:52 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Set `PYDEVD_DISABLE_FILE_VALIDATION` to silence warnings about frozen
modules from dev-python/pydevd.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 3 +++
1 file changed, 3 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 3d756eaad556..0a7b18e4a1a4 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1813,6 +1813,9 @@ distutils-r1_run_phase() {
local -x CYTHON_FORCE_REGEN=1
fi
+ # silence warnings when pydevd is loaded on Python 3.11+
+ local -x PYDEVD_DISABLE_FILE_VALIDATION=1
+
# Rust extensions are incompatible with C/C++ LTO compiler
# see e.g. https://bugs.gentoo.org/910220
if has cargo ${INHERITED}; then
--
2.42.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-18 16:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-18 16:52 [gentoo-dev] [PATCH 1/3] python-utils-r1.eclass: Do not pass `-p xdist` w/ PYTEST_PLUGINS Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 2/3] python-utils-r1.eclass: Do not pass `-p no:*` w/ no autoloading Michał Górny
2023-11-18 16:52 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Silence pydevd warnings Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox