pytestxdist IOError:无法发送到<Channel id=1 closed>

2024-10-02 00:37:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用pytest和pytest xlist来测试django应用程序,当我运行py.test -n 1时,我得到一个错误:

Test session starts (platform: linux2, Python 2.7.12, pytest 2.9.2, pytest-sugar 0.7.1)
django settings: icbase.settings (from ini file)
rootdir: /home/xsy/icgoo_git/datacenter3, inifile: pytest.ini
plugins: sugar-0.7.1, xdist-1.15.0, cov-2.3.1, django-2.9.1
gw0 okINTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/main.py", line 94, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/main.py", line 125, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "<remote exec>", line 50, in pytest_runtestloop
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/execnet/gateway_base.py", line 732, in receive
INTERNALERROR>     x = itemqueue.get(timeout=timeout)
INTERNALERROR>   File "/usr/lib64/python2.7/Queue.py", line 168, in get
INTERNALERROR>     self.not_empty.wait()
INTERNALERROR>   File "/usr/lib64/python2.7/threading.py", line 340, in wait
INTERNALERROR>     waiter.acquire()
INTERNALERROR>   File "gevent/_semaphore.py", line 198, in gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:4117)
INTERNALERROR>     def acquire(self, blocking=True, timeout=None):
INTERNALERROR>   File "gevent/_semaphore.py", line 226, in gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:3944)
INTERNALERROR>     timeout = self._do_wait(timeout)
INTERNALERROR>   File "gevent/_semaphore.py", line 166, in gevent._semaphore.Semaphore._do_wait (gevent/gevent._semaphore.c:3178)
INTERNALERROR>     result = get_hub().switch()
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/gevent/hub.py", line 609, in switch
INTERNALERROR>     return greenlet.switch(self)
INTERNALERROR> LoopExit: ('This operation would block forever', <Hub at 0x7faf27cf20f0 epoll default pending=0 ref=0 fileno=17>)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 7, in <module>
  File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/execnet/gateway_base.py", line 1534, in serve
    SlaveGateway(io=io, id=id, _startcount=2).serve()
  File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/execnet/gateway_base.py", line 1047, in serve
    self._execpool.integrate_as_primary_thread()
  File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/execnet/gateway_base.py", line 255, in integrate_as_primary_thread
    primary_thread_task_ready.wait()
  File "/usr/lib64/python2.7/threading.py", line 617, in wait
    self.__cond.wait(timeout, balancing)
  File "/usr/lib64/python2.7/threading.py", line 340, in wait
    waiter.acquire()
  File "gevent/_semaphore.py", line 198, in gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:4117)
  File "gevent/_semaphore.py", line 226, in gevent._semaphore.Semaphore.acquire (gevent/gevent._semaphore.c:3944)
  File "gevent/_semaphore.py", line 166, in gevent._semaphore.Semaphore._do_wait (gevent/gevent._semaphore.c:3178)
  File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/gevent/hub.py", line 609, in switch
    return greenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x7faf27cf20f0 epoll default pending=0 ref=0 fileno=17>)
gw0 [4]
scheduling tests via LoadScheduling
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/main.py", line 94, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/main.py", line 125, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/dsession.py", line 536, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/dsession.py", line 555, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/dsession.py", line 647, in slave_collectionfinish
INTERNALERROR>     self.sched.init_distribute()
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/dsession.py", line 380, in init_distribute
INTERNALERROR>     self._send_tests(next(nodes), 1)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/dsession.py", line 392, in _send_tests
INTERNALERROR>     node.send_runtest_some(tests_per_node)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/slavemanage.py", line 255, in send_runtest_some
INTERNALERROR>     self.sendcommand("runtests", indices=indices)
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/xdist/slavemanage.py", line 271, in sendcommand
INTERNALERROR>     self.channel.send((name, kwargs))
INTERNALERROR>   File "/home/xsy/.virtualenvs/dc3/lib/python2.7/site-packages/execnet/gateway_base.py", line 716, in send
INTERNALERROR>     raise IOError("cannot send to %r" % (self,))
INTERNALERROR> IOError: cannot send to <Channel id=1 closed>

以下是我的要求:

^{pr2}$

有人说这个问题是execnet 1.2错误(here),但我使用的是execnet 1.4.1

谁能帮上忙?在


Tags: inpyselfhomepytestlibpackagesline

热门问题