commit:     6529d0e0ec017c4fa3048235649d25e71c967941
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 22 17:27:32 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Apr 22 17:27:32 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6529d0e0

test_iter_completed: fix max_load in testAsyncCancel

Since async_iter_completed sets a default multiprocessing.cpu_count()
value when max_load is None, use max_load=True to disable the load
limit.

Fixes: a9e8ebaa6979 ("Add async_iter_completed for asyncio migration (bug 
591760)")

 pym/portage/tests/util/futures/test_iter_completed.py | 2 +-
 pym/portage/util/_async/AsyncScheduler.py             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/tests/util/futures/test_iter_completed.py 
b/pym/portage/tests/util/futures/test_iter_completed.py
index b07146ed3..71343c22d 100644
--- a/pym/portage/tests/util/futures/test_iter_completed.py
+++ b/pym/portage/tests/util/futures/test_iter_completed.py
@@ -69,7 +69,7 @@ class IterCompletedTestCase(TestCase):
                                yield future
 
                for future_done_set in async_iter_completed(future_generator(),
-                       max_jobs=True, max_load=None, loop=loop):
+                       max_jobs=True, max_load=True, loop=loop):
                        future_done_set.cancel()
                        break
 

diff --git a/pym/portage/util/_async/AsyncScheduler.py 
b/pym/portage/util/_async/AsyncScheduler.py
index 3deb6cb04..9beb8a848 100644
--- a/pym/portage/util/_async/AsyncScheduler.py
+++ b/pym/portage/util/_async/AsyncScheduler.py
@@ -14,7 +14,7 @@ class AsyncScheduler(AsynchronousTask, PollScheduler):
                if max_jobs is None:
                        max_jobs = 1
                self._max_jobs = max_jobs
-               self._max_load = max_load
+               self._max_load = None if max_load is True else max_load
                self._error_count = 0
                self._running_tasks = set()
                self._remaining_tasks = True

Reply via email to