我正在使用 pytest 和 pytest-xdist 来测试 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>
以下是我的要求:
apipkg==1.4
coverage==4.2
Django==1.9.4
django-test-plus==1.0.14
execnet==1.4.1
gevent==1.1.2
greenlet==0.4.10
gunicorn==19.4.5
lxml==3.6.0
MySQL-python==1.2.5
py==1.4.31
pymongo==3.3.0
pytest==2.9.2
pytest-cov==2.3.1
pytest-django==2.9.1
pytest-sugar==0.7.1
pytest-xdist==1.15.0
python-Levenshtein==0.12.0
python-memcached==1.57
requests==2.9.1
six==1.10.0
suds==0.4
termcolor==1.1.0
有人说这个问题是 execnet 1.2 错误(这里),但我使用的是 execnet 1.4.1
任何人都可以帮忙吗?