summaryrefslogtreecommitdiff
blob: ff1ec99c9e653fc1f3f8acbafd7babe104aa2a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7..9} )

inherit distutils-r1

DESCRIPTION="http client/server for asyncio"
HOMEPAGE="https://pypi.org/project/aiohttp/"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~riscv sparc x86"
IUSE="doc test"
RESTRICT="!test? ( test )"

COMMON_DEPEND="
	>=dev-python/async_timeout-3.0.0[${PYTHON_USEDEP}]
	>=dev-python/attrs-17.3.0[${PYTHON_USEDEP}]
	dev-python/chardet[${PYTHON_USEDEP}]
	>=dev-python/multidict-4.5.0[${PYTHON_USEDEP}]
	>=dev-python/yarl-1.0[${PYTHON_USEDEP}]
	$(python_gen_cond_dep '
		dev-python/idna-ssl[${PYTHON_USEDEP}]
	' python3_6)
	dev-python/typing-extensions[${PYTHON_USEDEP}]
"
DEPEND="
	dev-python/cython[${PYTHON_USEDEP}]
	test? (
		${COMMON_DEPEND}
		!!dev-python/pytest-aiohttp
		dev-python/async_generator[${PYTHON_USEDEP}]
		dev-python/brotlipy[${PYTHON_USEDEP}]
		dev-python/freezegun[${PYTHON_USEDEP}]
		www-servers/gunicorn[${PYTHON_USEDEP}]
		>=dev-python/pytest-3.4.0[${PYTHON_USEDEP}]
		dev-python/pytest-mock[${PYTHON_USEDEP}]
		dev-python/pytest-timeout[${PYTHON_USEDEP}]
		dev-python/trustme[${PYTHON_USEDEP}]
	)
"
RDEPEND="${COMMON_DEPEND}"

DOCS=( CHANGES.rst CONTRIBUTORS.txt README.rst )

distutils_enable_sphinx docs \
	'>=dev-python/alabaster-0.6.2' \
	'dev-python/sphinxcontrib-asyncio' \
	'dev-python/sphinxcontrib-blockdiag' \
	'dev-python/sphinxcontrib-newsfeed' \
	'dev-python/sphinxcontrib-spelling' \
	'dev-python/sphinx' \
	'dev-python/sphinx-aiohttp-theme'

distutils_enable_tests pytest || die "Tests fail with ${EPYTHON}"

python_prepare_all() {
	sed -e 's|^async def test_aiohttp_request_coroutine(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_handle_keepalive_on_closed_connection(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_server_close_keepalive_connection(|@pytest.mark.xfail\n\0|' \
		-i tests/test_client_functional.py || die

	sed -e 's|^async def test_request_tracing_exception(|@pytest.mark.xfail\n\0|' \
		-i tests/test_client_session.py || die

	sed -e 's|^async def test_cleanup2(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_cleanup3(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_abort_closed_transports(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_cancels_cleanup_closed_handle(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_cancels_cleanup_handle(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_during_connect(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_twice(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_close_with_acquired_connection(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_queued_operation_tracing(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_reuseconn_tracing(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_with_limit(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_with_limit_and_limit_per_host(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_with_limit_concurrent(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_with_no_limit_and_limit_per_host(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_connect_with_no_limits(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_get(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_get_expired(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_get_expired_ssl(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_limit_per_host_property(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_limit_per_host_property_default(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_limit_property(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_limit_property_default(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_acquired(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_acquired_closed(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_already_closed(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_close_do_not_delete_existing_connections(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_not_started(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_ssl_transport(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_first_available(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_no_available(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_no_limit(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_per_host(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_release_first(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_release_waiter_skip_done_waiter(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_tcp_connector_dns_throttle_requests_cancelled_when_close(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_tcp_connector_do_not_raise_connector_ssl_error(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_tcp_connector_uses_provided_local_addr(|@pytest.mark.xfail\n\0|' \
		-i tests/test_connector.py || die

	sed -e 's|^    async def test_read_boundary_with_incomplete_chunk(|    @pytest.mark.xfail\n\0|' \
		-e 's|^    async def test_read_incomplete_chunk(|    @pytest.mark.xfail\n\0|' \
		-i tests/test_multipart.py || die

	sed -e 's|^def test_aiohttp_plugin_async_fixture(|@pytest.mark.xfail\n\0|' \
		-i tests/test_pytest_plugin.py || die

	sed -e 's|^def test_static(|@pytest.mark.xfail\n\0|' \
		-i tests/test_route_def.py || die

	sed -e 's|^async def test_mixed_middleware(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_new_style_middleware_class(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_new_style_middleware_method(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_old_style_middleware(|@pytest.mark.xfail\n\0|' \
		-e 's|^async def test_old_style_middleware_class(|@pytest.mark.xfail\n\0|' \
		-i tests/test_web_middleware.py || die

	sed -e 's|^async def test_client_disconnect(|@pytest.mark.xfail\n\0|' \
		-i tests/test_web_protocol.py || die

	sed -e 's|^async def test_static_file_range(|@pytest.mark.xfail\n\0|' \
		-i tests/test_web_sendfile_functional.py || die

	sed -e 's|^async def test_partially_applied_handler(|@pytest.mark.xfail\n\0|' \
		-i tests/test_web_urldispatcher.py || die

	# minor breakages on py3.9
	sed -e 's:test_iface:_&:' \
		-i tests/test_frozenlist.py || die
	sed -e 's:test_proxy_https_bad_response:_&:' \
		-i tests/test_proxy_functional.py || die

	# newer chardet works too
	sed -e 's|chardet>=2.0,<4.0|chardet>=2.0|' \
		-i setup.py aiohttp.egg-info/requires.txt || die

	distutils-r1_python_prepare_all
}

python_test() {
	pushd "${BUILD_DIR}/lib" >/dev/null || die
	ln -snf "${S}/tests" tests || die
	pytest -vv || die "Tests fail with ${EPYTHON}"
	rm -rf .pytest_cache tests || die
	popd >/dev/null || die
}