summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-03-17 13:35:08 +0100
committerMichał Górny <mgorny@gentoo.org>2020-03-17 17:55:45 +0100
commit7aeeea23e4e404ea98c891fd425af29ddaaec899 (patch)
tree12955bb76660d079ff19dc806ba794ffcb3ea85b /dev-python/aiohttp-cors
parentdev-python/aiohttp-cors: Remove fake python3.7 support (diff)
downloadgentoo-7aeeea23e4e404ea98c891fd425af29ddaaec899.tar.gz
gentoo-7aeeea23e4e404ea98c891fd425af29ddaaec899.tar.bz2
gentoo-7aeeea23e4e404ea98c891fd425af29ddaaec899.zip
dev-python/aiohttp-cors: Fix test deps
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/aiohttp-cors')
-rw-r--r--dev-python/aiohttp-cors/aiohttp-cors-0.7.0.ebuild27
-rw-r--r--dev-python/aiohttp-cors/files/aiohttp-cors-0.7.0-tests.patch66
2 files changed, 76 insertions, 17 deletions
diff --git a/dev-python/aiohttp-cors/aiohttp-cors-0.7.0.ebuild b/dev-python/aiohttp-cors/aiohttp-cors-0.7.0.ebuild
index ab9ba261f9d9..bcc29302a0a0 100644
--- a/dev-python/aiohttp-cors/aiohttp-cors-0.7.0.ebuild
+++ b/dev-python/aiohttp-cors/aiohttp-cors-0.7.0.ebuild
@@ -15,28 +15,21 @@ EGIT_REPO_URI="https://github.com/aio-libs/aiohttp-cors"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE="test"
-RESTRICT="!test? ( test )"
RDEPEND=">=dev-python/aiohttp-1.1.1[${PYTHON_USEDEP}]"
-DEPEND="${RDEPEND}
- dev-python/setuptools[${PYTHON_USEDEP}]
+BDEPEND="
test? (
- dev-python/pylint[${PYTHON_USEDEP}]
- dev-python/pytest[${PYTHON_USEDEP}]
- dev-python/pytest-cov[${PYTHON_USEDEP}]
- dev-python/pytest-pylint[${PYTHON_USEDEP}]
- dev-python/pytest-runner[${PYTHON_USEDEP}]
+ dev-python/pytest-aiohttp[${PYTHON_USEDEP}]
dev-python/selenium[${PYTHON_USEDEP}]
)"
-python_prepare_all() {
- # for some reason, it is installed by 'setup.py test' on py!=3.4
- # TODO: investigate
- sed -i -e '/typing/d' setup.py || die
- distutils-r1_python_prepare_all
-}
+distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/aiohttp-cors-0.7.0-tests.patch
+)
-python_test() {
- esetup.py test
+src_prepare() {
+ sed -i -e '/^addopts=/d' setup.cfg || die
+ distutils-r1_src_prepare
}
diff --git a/dev-python/aiohttp-cors/files/aiohttp-cors-0.7.0-tests.patch b/dev-python/aiohttp-cors/files/aiohttp-cors-0.7.0-tests.patch
new file mode 100644
index 000000000000..e6480b58ea68
--- /dev/null
+++ b/dev-python/aiohttp-cors/files/aiohttp-cors-0.7.0-tests.patch
@@ -0,0 +1,66 @@
+From fed5542836c6afa925f3b607d544a92307c5e09f Mon Sep 17 00:00:00 2001
+From: Andrew Svetlov <andrew.svetlov@gmail.com>
+Date: Mon, 15 Oct 2018 21:32:48 +0300
+Subject: [PATCH] Fix tests
+
+---
+ tests/integration/test_real_browser.py | 18 ++++++++----------
+ tests/unit/test_cors_config.py | 5 ++---
+ 2 files changed, 10 insertions(+), 13 deletions(-)
+
+diff --git a/tests/integration/test_real_browser.py b/tests/integration/test_real_browser.py
+index a5c9030..5dff79a 100644
+--- a/tests/integration/test_real_browser.py
++++ b/tests/integration/test_real_browser.py
+@@ -193,22 +193,20 @@ class IntegrationServers:
+
+ # Start servers.
+ for server_name, server_descr in self.servers.items():
+- handler = server_descr.app.make_handler()
+- server = await self.loop.create_server(
+- handler,
+- sock=server_sockets[server_name])
+- server_descr.handler = handler
+- server_descr.server = server
++ runner = web.AppRunner(server_descr.app)
++ await runner.setup()
++ site = web.SockSite(runner, server_sockets[server_name])
++ await site.start()
++ server_descr.runner = runner
+
+ self._logger.info("Started server '%s' at '%s'",
+ server_name, server_descr.url)
+
+ async def stop_servers(self):
+ for server_descr in self.servers.values():
+- server_descr.server.close()
+- await server_descr.handler.shutdown()
+- await server_descr.server.wait_closed()
+- await server_descr.app.cleanup()
++ runner = server_descr.runner
++ await runner.shutdown()
++ await runner.cleanup()
+
+ self.servers = {}
+
+diff --git a/tests/unit/test_cors_config.py b/tests/unit/test_cors_config.py
+index 5b8d8f3..817410e 100644
+--- a/tests/unit/test_cors_config.py
++++ b/tests/unit/test_cors_config.py
+@@ -58,11 +58,10 @@ def options_route(app):
+ "OPTIONS", "/options_path", _handler)
+
+
+-def test_add_options_route(cors, options_route):
++def test_add_options_route(app, cors, options_route):
+ """Test configuring OPTIONS route"""
+-
+ with pytest.raises(ValueError,
+- match="/options_path already has OPTIONS handler"):
++ match="already has OPTIONS handler"):
+ cors.add(options_route.resource)
+
+
+--
+2.25.1
+