commit: ba72d2be45a4f4203695aec1fb23b35c46fe2339 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Thu Apr 18 13:46:55 2024 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Thu Apr 18 15:45:39 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba72d2be
dev-python/autobahn: Fix asyncio testing Closes: https://bugs.gentoo.org/930184 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-python/autobahn/autobahn-23.6.2.ebuild | 10 +++++- .../files/autobahn-23.6.2-pytest-asyncio.patch | 42 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/dev-python/autobahn/autobahn-23.6.2.ebuild b/dev-python/autobahn/autobahn-23.6.2.ebuild index ac905597289a..36d7b545322e 100644 --- a/dev-python/autobahn/autobahn-23.6.2.ebuild +++ b/dev-python/autobahn/autobahn-23.6.2.ebuild @@ -58,6 +58,11 @@ BDEPEND=" " python_prepare_all() { + local PATCHES=( + # https://github.com/crossbario/autobahn-python/pull/1634 + "${FILESDIR}/${P}-pytest-asyncio.patch" + ) + if use xbr ; then eerror "***************" eerror "Required xbr dependencies are incomplete in Gentoo." @@ -89,8 +94,11 @@ python_test() { unset USE_TWISTED einfo "RE-testing cryptosign and component_aio using asyncio" + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 local -x USE_ASYNCIO=true - epytest --pyargs autobahn.wamp.test.test_wamp_{cryptosign,component_aio} + epytest -p asyncio --pyargs \ + autobahn.asyncio.test.test_aio_{raw,web}socket \ + autobahn.wamp.test.test_wamp_{cryptosign,component_aio} unset USE_ASYNCIO rm -f twisted/plugins/dropin.cache || die diff --git a/dev-python/autobahn/files/autobahn-23.6.2-pytest-asyncio.patch b/dev-python/autobahn/files/autobahn-23.6.2-pytest-asyncio.patch new file mode 100644 index 000000000000..2cdbd863231b --- /dev/null +++ b/dev-python/autobahn/files/autobahn-23.6.2-pytest-asyncio.patch @@ -0,0 +1,42 @@ +From 5ab94618723c488df640ae0777ac5a16ee1ab369 Mon Sep 17 00:00:00 2001 +From: David Hotham <david.hot...@microsoft.com> +Date: Sat, 13 Apr 2024 05:27:01 +0100 +Subject: [PATCH] unit test fixes (#1634) + +--- + autobahn/wamp/test/test_wamp_component_aio.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/autobahn/wamp/test/test_wamp_component_aio.py b/autobahn/wamp/test/test_wamp_component_aio.py +index 168933ea5..2de9bf358 100644 +--- a/autobahn/wamp/test/test_wamp_component_aio.py ++++ b/autobahn/wamp/test/test_wamp_component_aio.py +@@ -35,7 +35,7 @@ + + @pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+") + @pytest.mark.asyncio(forbid_global_loop=True) +- def test_asyncio_component(event_loop): ++ async def test_asyncio_component(event_loop): + orig_loop = txaio.config.loop + txaio.config.loop = event_loop + +@@ -72,11 +72,11 @@ def done(f): + txaio.config.loop = orig_loop + assert comp._done_f is None + f.add_done_callback(done) +- return finished ++ await finished + + @pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+") + @pytest.mark.asyncio(forbid_global_loop=True) +- def test_asyncio_component_404(event_loop): ++ async def test_asyncio_component_404(event_loop): + """ + If something connects but then gets aborted, it should still try + to re-connect (in real cases this could be e.g. wrong path, +@@ -151,4 +151,4 @@ def done(f): + finished.set_result(None) + txaio.config.loop = orig_loop + f.add_done_callback(done) +- return finished ++ await finished