1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
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"
16 KEYWORDS="amd64 ~arm64 ppc64 x86"
19 RDEPEND="dev-python/urllib3[${PYTHON_USEDEP}]"
21 dev-python/setuptools[${PYTHON_USEDEP}]
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}]
33 #Required for test phase
34 DISTUTILS_IN_SOURCE_BUILD=1
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
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 \
56 tests/functional || die "Tests failed under python2.7"
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 \
64 tests/functional || die "Tests failed under python3.3"
67 rm -rf "${BUILD_DIR}"/../tests/ || die