Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/coverage/
Date: Mon, 21 Feb 2022 15:00:58
Message-Id: 1645453466.c883fd019a856c27c984fb0c69fd3c75c3fc7da9.mgorny@gentoo
1 commit: c883fd019a856c27c984fb0c69fd3c75c3fc7da9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 21 14:03:40 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 21 14:24:26 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c883fd01
7
8 dev-python/coverage: Fix tests
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/coverage/coverage-6.3.2-r1.ebuild | 59 ++++++++++++++++++++++++++++
13 1 file changed, 59 insertions(+)
14
15 diff --git a/dev-python/coverage/coverage-6.3.2-r1.ebuild b/dev-python/coverage/coverage-6.3.2-r1.ebuild
16 new file mode 100644
17 index 000000000000..42d6490e525c
18 --- /dev/null
19 +++ b/dev-python/coverage/coverage-6.3.2-r1.ebuild
20 @@ -0,0 +1,59 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +DISTUTILS_USE_PEP517=setuptools
27 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
28 +PYTHON_REQ_USE="threads(+),sqlite(+)"
29 +
30 +inherit distutils-r1
31 +
32 +DESCRIPTION="Code coverage measurement for Python"
33 +HOMEPAGE="https://coverage.readthedocs.io/en/latest/ https://pypi.org/project/coverage/"
34 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
35 +
36 +LICENSE="BSD"
37 +SLOT="0"
38 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-macos"
39 +
40 +BDEPEND="
41 + test? (
42 + dev-python/flaky[${PYTHON_USEDEP}]
43 + dev-python/hypothesis[${PYTHON_USEDEP}]
44 + dev-python/pytest-xdist[${PYTHON_USEDEP}]
45 + >=dev-python/unittest-mixins-1.4[${PYTHON_USEDEP}]
46 + )
47 +"
48 +
49 +distutils_enable_tests pytest
50 +
51 +src_prepare() {
52 + sed -i -e '/^addopts/s:-q -n auto::' setup.cfg || die
53 + distutils-r1_src_prepare
54 +}
55 +
56 +test_tracer() {
57 + local -x COVERAGE_TEST_TRACER=${1}
58 + einfo " Testing with the ${COVERAGE_TEST_TRACER} tracer ..."
59 + epytest tests
60 +}
61 +
62 +python_test() {
63 + "${EPYTHON}" igor.py zip_mods || die
64 +
65 + local -x COVERAGE_TESTING=True
66 + # TODO: figure out why they can't be imported inside test env
67 + local -x COVERAGE_NO_CONTRACTS=1
68 + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
69 + local -x PYTEST_PLUGINS=_hypothesis_pytestplugin,flaky.flaky_pytest_plugin,xdist.plugin
70 +
71 + if [[ ${EPYTHON} != pypy* ]]; then
72 + cp "${BUILD_DIR}/install$(python_get_sitedir)"/coverage/*.so \
73 + coverage/ || die
74 + test_tracer c
75 + rm coverage/*.so || die
76 + else
77 + test_tracer py
78 + fi
79 +}