summaryrefslogtreecommitdiff
path: root/eclass/python-utils-r1.eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2025-07-05 07:48:05 +0200
committerMichał Górny <mgorny@gentoo.org>2025-07-12 07:05:17 +0200
commit4bc191233cf98231275dc7a997e6cb67f8c81481 (patch)
treee1f92ed3405d10d8ec90e92434dbb653daea97d2 /eclass/python-utils-r1.eclass
parent2121bd955b56bcfbcfca92bec5669532acb575a0 (diff)
downloadgentoo-4bc191233cf98231275dc7a997e6cb67f8c81481.tar.gz
gentoo-4bc191233cf98231275dc7a997e6cb67f8c81481.tar.bz2
gentoo-4bc191233cf98231275dc7a997e6cb67f8c81481.zip
python-utils-r1.eclass: epytest, support --hypothesis-profile=gentoo
Support using the "gentoo" hypothesis profile, as installed by dev-python/hypothesis-gentoo, to disable all Hypothesis health checks. This avoids spurious test failures, e.g. when the system is under load and the strategies are underperforming. Signed-off-by: Michał Górny <mgorny@gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/42876 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass11
1 files changed, 11 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index dce565b8b036..9e94acf34edf 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1518,6 +1518,17 @@ epytest() {
fi
fi
+ # If we are using hypothesis (require use via EPYTEST_PLUGINS, since
+ # ebuilds may disable autoloading manually) *and* hypothesis-gentoo
+ # is available, use it to disable all health checks, to prevent the tests
+ # from failing randomly under load.
+ if has hypothesis "${EPYTEST_PLUGINS[@]}" &&
+ "${EPYTHON}" -c 'import hypothesis_gentoo' 2>/dev/null &&
+ [[ ! ${HYPOTHESIS_NO_PLUGINS} ]]
+ then
+ args+=( --hypothesis-profile=gentoo )
+ fi
+
local x
for x in "${EPYTEST_DESELECT[@]}"; do
args+=( --deselect "${x}" )