Make epytest clean up common cache directories .hypothesis
and .pytest_cache after the execution.  If pytest is executed
in ${BUILD_DIR}/lib, these directories end up being wrongly installed,
and so far ebuilds had to handle cleaning them up.

Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 eclass/python-utils-r1.eclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 168c767a2eea..b104b6694ac3 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1272,7 +1272,12 @@ epytest() {
 
        echo "${@}" >&2
        "${@}" || die -n "pytest failed with ${EPYTHON}"
-       return ${?}
+       local ret=${?}
+
+       # remove common temporary directories left over by pytest plugins
+       rm -rf .hypothesis .pytest_cache || die
+
+       return ${ret}
 }
 
 # @FUNCTION: eunittest
-- 
2.32.0


Reply via email to