commit:     71374edfc174ffbd6ae8b6b80ad65629697d5fbd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 10 17:55:32 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug  7 13:52:49 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71374edf

python-utils-r1.eclass: Cleanup cache dirs after epytest

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 <mgorny <AT> 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 168c767a2ee..b104b6694ac 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

Reply via email to