869bb8593ddde93f007dc899db01837dfcaf23a9
[gentoo.git] / dev-python / wsgiintercept / wsgiintercept-1.3.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python3_{5,6} )
7
8 inherit distutils-r1
9
10 MY_PN="wsgi_intercept"
11 MY_P="${MY_PN}-${PV}"
12
13 DESCRIPTION="WSGI application in place of a real URI for testing"
14 HOMEPAGE="https://github.com/cdent/python3-wsgi-intercept"
15 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
16
17 SLOT="0"
18 LICENSE="MIT"
19 KEYWORDS="amd64 ~arm64 x86 ~amd64-linux ~x86-linux"
20 IUSE="doc test"
21 RESTRICT="!test? ( test )"
22 RDEPEND=""
23 DEPEND="
24         dev-python/setuptools[${PYTHON_USEDEP}]
25         dev-python/six[${PYTHON_USEDEP}]
26         test? (
27                 dev-python/httplib2[${PYTHON_USEDEP}]
28                 >=dev-python/pytest-2.4[${PYTHON_USEDEP}]
29                 >=dev-python/requests-2.0.1[${PYTHON_USEDEP}]
30                 >=dev-python/urllib3-1.11.0[${PYTHON_USEDEP}]
31                 $(python_gen_cond_dep 'dev-python/mechanize[${PYTHON_USEDEP}]' python2_7 pypy)
32         )"
33 S="${WORKDIR}/${MY_P}"
34
35 python_prepare_all() {
36         # .pyc files cause failure of tests
37         rm -rf test/__pycache__/ || die
38
39         # Req'd to avoid file collisions
40         sed -e s":find_packages():find_packages(exclude=['test']):" \
41                 -i setup.py || die
42
43         # Disable tests connecting to the network; Bug #550710
44         sed -e 's:test_http_not_intercepted:_&:' \
45                 -e 's:test_https_not_intercepted:_&:' \
46                 -i test/{test_urllib.py,test_http_client.py,test_requests.py} || die
47         distutils-r1_python_prepare_all
48 }
49
50 python_compile_all() {
51         use doc && emake -C docs html
52 }
53
54 python_test() {
55         py.test || die "Tests failed under ${EPYTHON}"
56 }
57
58 python_install_all() {
59         use doc && local HTML_DOCS=( docs/_build/html//. )
60         distutils-r1_python_install_all
61 }