3d6a7a5ab186651636a696bfb34f39a51fa4bf07
[gentoo.git] / dev-python / pytest / pytest-5.3.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7,8} )
7
8 inherit distutils-r1
9
10 DESCRIPTION="Simple powerful testing with Python"
11 HOMEPAGE="https://pytest.org/"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
14 LICENSE="MIT"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="test"
18 RESTRICT="!test? ( test )"
19
20 # When bumping, please check setup.py for the proper py version
21 PY_VER="1.5.0"
22
23 # pathlib2 has been added to stdlib before py3.6, but pytest needs __fspath__
24 # support, which only came in py3.6.
25 RDEPEND="
26         >=dev-python/attrs-17.4.0[${PYTHON_USEDEP}]
27         dev-python/importlib_metadata[${PYTHON_USEDEP}]
28         >=dev-python/more-itertools-4.0.0[${PYTHON_USEDEP}]
29         dev-python/packaging[${PYTHON_USEDEP}]
30         >=dev-python/pluggy-0.12[${PYTHON_USEDEP}]
31         <dev-python/pluggy-1
32         >=dev-python/py-${PY_VER}[${PYTHON_USEDEP}]
33         dev-python/six[${PYTHON_USEDEP}]
34         dev-python/wcwidth[${PYTHON_USEDEP}]
35         virtual/python-funcsigs[${PYTHON_USEDEP}]"
36
37 # flake cause a number of tests to fail
38 DEPEND="${RDEPEND}
39         test? (
40                 >=dev-python/hypothesis-3.56[${PYTHON_USEDEP}]
41                 dev-python/nose[${PYTHON_USEDEP}]
42                 dev-python/mock[${PYTHON_USEDEP}]
43                 dev-python/requests[${PYTHON_USEDEP}]
44                 >=dev-python/setuptools-40[${PYTHON_USEDEP}]
45                 dev-python/xmlschema[${PYTHON_USEDEP}]
46                 !!dev-python/flaky
47         )"
48
49 PATCHES=(
50         "${FILESDIR}/${PN}"-4.5.0-strip-setuptools_scm.patch
51 )
52
53 python_prepare_all() {
54         grep -qF "py>=${PY_VER}" setup.py || die "Incorrect dev-python/py dependency"
55
56         # Something in the ebuild environment causes this to hang/error.
57         # https://bugs.gentoo.org/598442
58         rm testing/test_pdb.py || die
59
60         distutils-r1_python_prepare_all
61 }
62
63 python_test() {
64         "${EPYTHON}" -m pytest -vv --lsof -rfsxX \
65                 || die "tests failed with ${EPYTHON}"
66 }