Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Cleanup cache dirs after epytest
Date: Sat, 10 Jul 2021 17:57:10
Message-Id: 20210710175701.543152-1-mgorny@gentoo.org
1 Make epytest clean up common cache directories .hypothesis
2 and .pytest_cache after the execution. If pytest is executed
3 in ${BUILD_DIR}/lib, these directories end up being wrongly installed,
4 and so far ebuilds had to handle cleaning them up.
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/python-utils-r1.eclass | 7 ++++++-
9 1 file changed, 6 insertions(+), 1 deletion(-)
10
11 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
12 index 168c767a2eea..b104b6694ac3 100644
13 --- a/eclass/python-utils-r1.eclass
14 +++ b/eclass/python-utils-r1.eclass
15 @@ -1272,7 +1272,12 @@ epytest() {
16
17 echo "${@}" >&2
18 "${@}" || die -n "pytest failed with ${EPYTHON}"
19 - return ${?}
20 + local ret=${?}
21 +
22 + # remove common temporary directories left over by pytest plugins
23 + rm -rf .hypothesis .pytest_cache || die
24 +
25 + return ${ret}
26 }
27
28 # @FUNCTION: eunittest
29 --
30 2.32.0