commit: 66d8f8388e5b9da7e07510f78ec487913e2ceaf5 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun Feb 4 00:16:29 2024 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Wed Feb 7 00:36:17 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=66d8f838
ChildWatcherTestCase: Remove obsolete test which uses spawn returnpid This test was added for bug 649588 when there was still an internal event loop implementation for python2. It is no longer relevant and uses the deprecated spawn returnpid parameter, so remove it. Bug: https://bugs.gentoo.org/916566 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/tests/util/futures/asyncio/meson.build | 1 - .../util/futures/asyncio/test_child_watcher.py | 50 ---------------------- 2 files changed, 51 deletions(-) diff --git a/lib/portage/tests/util/futures/asyncio/meson.build b/lib/portage/tests/util/futures/asyncio/meson.build index ba727052fc..2de0668d6b 100644 --- a/lib/portage/tests/util/futures/asyncio/meson.build +++ b/lib/portage/tests/util/futures/asyncio/meson.build @@ -1,6 +1,5 @@ py.install_sources( [ - 'test_child_watcher.py', 'test_event_loop_in_fork.py', 'test_pipe_closed.py', 'test_policy_wrapper_recursion.py', diff --git a/lib/portage/tests/util/futures/asyncio/test_child_watcher.py b/lib/portage/tests/util/futures/asyncio/test_child_watcher.py deleted file mode 100644 index cd100598b7..0000000000 --- a/lib/portage/tests/util/futures/asyncio/test_child_watcher.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2018-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -import os - -from portage.process import find_binary, spawn -from portage.tests import TestCase -from portage.util._eventloop.global_event_loop import global_event_loop -from portage.util.futures import asyncio -from portage.util.futures.unix_events import DefaultEventLoopPolicy - - -class ChildWatcherTestCase(TestCase): - def testChildWatcher(self): - true_binary = find_binary("true") - self.assertNotEqual(true_binary, None) - - initial_policy = asyncio.get_event_loop_policy() - if not isinstance(initial_policy, DefaultEventLoopPolicy): - asyncio.set_event_loop_policy(DefaultEventLoopPolicy()) - - loop = None - try: - try: - asyncio.set_child_watcher(None) - except NotImplementedError: - pass - else: - self.assertTrue(False) - - args_tuple = ("hello", "world") - - loop = asyncio._wrap_loop() - future = loop.create_future() - - def callback(pid, returncode, *args): - future.set_result((pid, returncode, args)) - - async def watch_pid(): - with asyncio.get_child_watcher() as watcher: - pids = spawn([true_binary], returnpid=True) - watcher.add_child_handler(pids[0], callback, *args_tuple) - self.assertEqual((await future), (pids[0], os.EX_OK, args_tuple)) - - loop.run_until_complete(watch_pid()) - finally: - asyncio.set_event_loop_policy(initial_policy) - if loop not in (None, global_event_loop()): - loop.close() - self.assertFalse(global_event_loop().is_closed())
