[英]nosetests -h fails to run with error
I suspect I failed to install nosetests correctly. 我怀疑我没能正确安装nosetests。 I used easy_install nose - output was 我用easy_install nose - 输出了
Searching for nose
Best match: nose 1.0.0
Processing nose-1.0.0-py2.7.egg
nose 1.0.0 is already the active version in easy-install.pth
Installing nosetests-script.py script to C:\Python27\Scripts
Installing nosetests.exe script to C:\Python27\Scripts
Installing nosetests-2.7-script.py script to C:\Python27\Script
Installing nosetests-2.7.exe script to C:\Python27\Scripts
So it looks like it installs fine. 所以看起来安装得很好。 But when I run nosetests -h 但是当我运行nosetests -h时
PS C:\Users\john\code\python> nosetests -h
Traceback (most recent call last):
File "C:\Python27\Scripts\nosetests-script.py", line 9, in <module>
load_entry_point('nose==1.0.0', 'console_scripts', 'nosetests')()
File "C:\Python27\lib\site-packages\nose-1.0.0-py2.7.egg\nose\core.py", line 118, in __init__
**extra_args)
TypeError: __init__() got an unexpected keyword argument 'exit'
Did I miss a setup step somehow? 我是否错过了设置步骤?
Weird. 奇怪的。 In nose/core.py
the TestProgram
constructor calls the parent constructor like this: 在nose/core.py
, TestProgram
构造函数调用父构造函数,如下所示:
...
extra_args = {}
version = sys.version_info[0:2]
if version >= (2,7) and version != (3,0):
extra_args['exit'] = exit
unittest.TestProgram.__init__(
self, module=module, defaultTest=defaultTest,
argv=argv, testRunner=testRunner, testLoader=testLoader,
**extra_args)
Constructor of TestProgram
in unittest/main.py
accepts the exit
argument: unittest/main.py
中TestProgram
构造unittest/main.py
接受exit
参数:
class TestProgram(object):
...
def __init__(self, module='__main__', defaultTest=None, argv=None,
testRunner=None, testLoader=loader.defaultTestLoader,
exit=True, verbosity=1, failfast=None, catchbreak=None,
buffer=None):
...
So... I don't know how this error could happen. 所以......我不知道这个错误是怎么发生的。 Do you have more versions of Python installed? 您是否安装了更多版本的Python? Is your nosetests really using the correct unittest
module for Python 2.7? 你的测试是否真的使用Python 2.7的正确unittest
模块? Can you look at unittest\\main.py
(somewhere in your C:\\Python27
) and check the TestProgram
constructor, whether it has an exit
argument? 你能看一下unittest\\main.py
(你的C:\\Python27
某个地方)并检查TestProgram
构造函数,它是否有exit
参数?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.