Skip to content

Commit

Permalink
python-utils-r1.eclass: Do not pass -p xdist w/ PYTEST_PLUGINS
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mgorny committed Nov 19, 2023
1 parent 5fd85ec commit a50f2ca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions eclass/python-utils-r1.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a50f2ca

Please sign in to comment.