[英]Why do I get the error “Invalid command nosetests” when I run nosetests from my virtualenv?
當我把它加載到Jenkins時,我首先注意到這個項目的問題。 更令人費解的是,我已經能夠重現如下:
在項目的原始版本中,以下命令按預期運行測試:
.venv/bin/python setup.py nosetests
然后我做以下事情:
.venv
如果我然后在這個版本上運行.venv/bin/python setup.py nosetests
,我得到以下結果:
setup.py: error: Invalid command nosetests
setup.py
包括以下設置:
setup_requires=[
'nose>=1.0', 'nosexcover', 'coverage', 'selenium', 'fixture'
],
test_suite='nose.collector',
我特別困惑,因為它在每個版本中都是相同的setup.py
和setup.cfg
文件,並且據我所知,環境是相同的。
我在邊欄中注意到這個Stack Overflow問題 ,它看起來非常相關,但是我提供的解決方案都沒有。
我遇到了同樣的問題並設法通過推桿修復它
setup_requires=['nose>=1.0']
進入我的setup.py
文件。 之后,我可以使用Python setup.py nosetests
選項。
一些有用的鏈接:
我從來沒有完全弄清楚潛在的問題。 但我確實找到了一個允許我讓我的構建運行的解決方法。 這是我在Jenkins的Virtualenv Builder中使用的命令:
# require nosetests be installed
# (old method using setup.py nosetests command does not work)
$VIRTUAL_ENV/bin/pip install nose
# install remain pip requirements
$VIRTUAL_ENV/bin/pip install -r requirements.pip
# must run this prior to running tests to install other nosetest dependencies
$VIRTUAL_ENV/bin/python setup.py install
# now we can run nosetests
# this does not work: $VIRTUAL_ENV/bin/python setup.py nosetests
$VIRTUAL_ENV/bin/nosetests -c setup.cfg
我懷疑根本問題與我的新virtualenv中虛擬環境的狀態和Distutils和Nose之間的某種版本不兼容有關。 舊的似乎隨着時間的推移已經達到了某種不穩定的配置,克隆和pip無法再創造。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.