提交 aeb9ff33 编写于 作者: C Cleber Rosa

avocado/core/runner.py: drop conditional import

On all tested Python 3 versions, the SimpleQueue is available from
the multiprocessing module, so let's drop the conditional import.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 eec874f6
......@@ -17,7 +17,7 @@
Test runner module.
"""
import multiprocessing.queues
import multiprocessing
import os
import signal
import sys
......@@ -582,14 +582,7 @@ class TestRunner(object):
summary = set()
if self.job.sysinfo is not None:
self.job.sysinfo.start_job_hook()
# Python 3 can choose a context type for queues, but SimpleQueue
# lives directly under the module namespace
if hasattr(multiprocessing, 'SimpleQueue'):
queue = multiprocessing.SimpleQueue()
else:
queue = multiprocessing.queues.SimpleQueue() # pylint: disable=E1125
queue = multiprocessing.SimpleQueue()
if timeout > 0:
deadline = time.time() + timeout
else:
......
......@@ -34,10 +34,7 @@ class TestRunnerQueue(unittest.TestCase):
:param factory: the Avocado Test factory
:return: the last queue message from the test
"""
if hasattr(multiprocessing, 'SimpleQueue'):
queue = multiprocessing.SimpleQueue()
else:
queue = multiprocessing.queues.SimpleQueue() # pylint: disable=E1125
queue = multiprocessing.SimpleQueue()
runner = TestRunner(job=self.job, result=self.result)
runner._run_test(factory, queue)
while not queue.empty():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册