dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / httpretty / httpretty-0.8.14.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
7
8 inherit distutils-r1
9
10 DESCRIPTION="HTTP client mock for Python"
11 HOMEPAGE="https://github.com/gabrielfalcao/httpretty"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
14 SLOT="0"
15 LICENSE="MIT"
16 KEYWORDS="amd64 ~arm64 ppc64 x86"
17 IUSE="test"
18
19 RDEPEND="dev-python/urllib3[${PYTHON_USEDEP}]"
20 DEPEND="
21         dev-python/setuptools[${PYTHON_USEDEP}]
22         test? (
23                 >=dev-python/coverage-3.5[${PYTHON_USEDEP}]
24                 >=dev-python/nose-1.2[${PYTHON_USEDEP}]
25                 >=dev-python/mock-1.0[${PYTHON_USEDEP}]
26                 dev-python/sure[${PYTHON_USEDEP}]
27                 dev-python/httplib2[${PYTHON_USEDEP}]
28                 >=dev-python/requests-1.1[${PYTHON_USEDEP}]
29                 >=www-servers/tornado-2.2[${PYTHON_USEDEP}]
30                 dev-python/ipdb[${PYTHON_USEDEP}]
31 )"
32
33 #Required for test phase
34 DISTUTILS_IN_SOURCE_BUILD=1
35
36 python_test() {
37         # https://github.com/gabrielfalcao/HTTPretty/issues/125, still occur
38         # py3.4 hangs on many tests and is deemed underdone
39         # Upstream does not make it clear whether py3.4 is sctually tested and supported.
40         # python2.7 has substantial failure in tests/functional/test_requests.py and is removed.
41         # Some tests excluded attempt connection to the network
42         # On testing in the state below, py2.7 still has a tally of FAILED (failures=5)
43         # that occur within the folder tests/unit which upstream should address.
44         # https://github.com/gabrielfalcao/HTTPretty/issues/236 Bug #532106
45
46         if python_is_python3; then
47                 einfo "python3* not adequately supported by th package"
48         elif [[ "${EPYTHON}" == python2.7 ]]; then
49                 rm -f tests/functional/test_requests.py || die
50                 nosetests -e test_recording_calls \
51                         -e test_playing_calls \
52                         -e test_callback_setting_headers_and_status_response \
53                         -e test_httpretty_bypasses_when_disabled \
54                         -e test_using_httpretty_with_other_tcp_protocols \
55                         tests/unit \
56                         tests/functional || die "Tests failed under python2.7"
57         else
58                 nosetests -e test_recording_calls \
59                         -e test_playing_calls \
60                         -e test_callback_setting_headers_and_status_response \
61                         -e test_httpretty_bypasses_when_disabled \
62                         -e test_using_httpretty_with_other_tcp_protocols \
63                         tests/unit \
64                         tests/functional || die "Tests failed under python3.3"
65         fi
66
67         rm -rf "${BUILD_DIR}"/../tests/ || die
68 }