mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 23:21:17 +02:00
eclass/python-utils-r1: Sync with Gentoo
It's from Gentoo commit 171a72e48ca08dd7d5f1a0f9c00d5a3297db1239.
This commit is contained in:
parent
b21400bb72
commit
5267f20799
@ -1307,6 +1307,21 @@ _python_check_occluded_packages() {
|
||||
# parameter, when calling epytest. The listed files will be entirely
|
||||
# skipped from test collection.
|
||||
|
||||
# @ECLASS_VARIABLE: EPYTEST_XDIST
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# If set to a non-empty value, enables running tests in parallel
|
||||
# via pytest-xdist plugin. If this variable is set prior to calling
|
||||
# distutils_enable_tests in distutils-r1, a test dependency
|
||||
# on dev-python/pytest-xdist is added automatically.
|
||||
|
||||
# @ECLASS_VARIABLE: EPYTEST_JOBS
|
||||
# @USER_VARIABLE
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# Specifies the number of jobs for parallel (pytest-xdist) test runs.
|
||||
# When unset, defaults to -j from MAKEOPTS, or the current nproc.
|
||||
|
||||
# @FUNCTION: epytest
|
||||
# @USAGE: [<args>...]
|
||||
# @DESCRIPTION:
|
||||
@ -1347,30 +1362,55 @@ 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
|
||||
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+=(
|
||||
-n "${jobs}"
|
||||
# worksteal ensures that workers don't end up idle when heavy
|
||||
# jobs are unevenly distributed
|
||||
--dist=worksteal
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
local x
|
||||
for x in "${EPYTEST_DESELECT[@]}"; do
|
||||
args+=( --deselect "${x}" )
|
||||
|
Loading…
x
Reference in New Issue
Block a user