The test suites of pytest plugins cause additional *-pytest-*.pyc files
to be created.  Remove them in order to prevent them from being
installed alongside the package.

Closes: https://bugs.gentoo.org/847235
Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 eclass/python-utils-r1.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 67dc5bf754d6..9eb068d3b13f 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1318,6 +1318,11 @@ epytest() {
 
        # remove common temporary directories left over by pytest plugins
        rm -rf .hypothesis .pytest_cache || die
+       # pytest plugins create additional .pyc files while testing
+       # see e.g. https://bugs.gentoo.org/847235
+       if [[ -n ${BUILD_DIR} && -d ${BUILD_DIR} ]]; then
+               find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die
+       fi
 
        return ${ret}
 }
-- 
2.35.1


Reply via email to