Merge remote-tracking branch 'github/pr/108'
[gentoo.git] / dev-python / pytest / pytest-2.7.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} pypy pypy3 )
7 inherit distutils-r1
8
9 DESCRIPTION="py.test: simple powerful testing with Python"
10 HOMEPAGE="http://pytest.org/ https://pypi.python.org/pypi/pytest"
11 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
12
13 LICENSE="MIT"
14 SLOT="0"
15 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
16 IUSE="doc test"
17
18 # When bumping, please check setup.py for the proper py version
19 PY_VER="1.4.29"
20 RDEPEND=">=dev-python/py-${PY_VER}[${PYTHON_USEDEP}]"
21
22 #pexpect dep based on https://bitbucket.org/hpk42/pytest/issue/386/tests-fail-with-pexpect-30
23 DEPEND="${RDEPEND}
24         dev-python/setuptools[${PYTHON_USEDEP}]
25         test? ( dev-python/pexpect[${PYTHON_USEDEP}] )
26         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
27
28 python_prepare_all() {
29         # Disable versioning of py.test script to avoid collision with
30         # versioning performed by the eclass.
31         sed -e "s/return points/return {'py.test': target}/" -i setup.py || die "sed failed"
32         grep -qF "py>=${PY_VER}" setup.py || die "Incorrect dev-python/py dependency"
33
34         # Prevent un-needed d'loading
35         sed -e "s/'sphinx.ext.intersphinx', //" -i doc/en/conf.py || die
36         distutils-r1_python_prepare_all
37 }
38
39 python_compile_all() {
40         if use doc; then
41                 mkdir doc/en/.build || die
42                 emake -C doc/en html
43         fi
44 }
45
46 python_test() {
47         # test_nose.py not written to suit py3.2 in pypy3
48         if [[ "${EPYTHON}" == pypy3 ]]; then
49                 "${PYTHON}" "${BUILD_DIR}"/lib/pytest.py \
50                         --ignore=testing/test_nose.py \
51                         || die "tests failed with ${EPYTHON}"
52         else
53                 "${PYTHON}" "${BUILD_DIR}"/lib/pytest.py \
54                         || die "tests failed with ${EPYTHON}"
55         fi
56 }
57
58 python_install_all() {
59         use doc && dohtml -r doc/en/_build/html/
60         distutils-r1_python_install_all
61 }