When I am using the nosetests 1.2.1 with coverage, it throws the below error.

/usr/lib/python2.6/site-packages/tw/core/view.py:223: DeprecationWarning: object.__new__() takes no parameters
obj = object.__new__(cls, *args, **kw)
Traceback (most recent call last):
File "/usr/bin/nosetests", line 9, in <module>
  load_entry_point('nose==1.2.1', 'console_scripts', 'nosetests')()
File "/usr/lib/python2.6/site-packages/nose/core.py", line 118, in __init__
**extra_args)
File "/usr/lib64/python2.6/unittest.py", line 815, in __init__
  self.parseArgs(argv)
File "/usr/lib/python2.6/site-packages/nose/core.py", line 135, in parseArgs
  self.config.configure(argv, doc=self.usage())
File "/usr/lib/python2.6/site-packages/nose/config.py", line 338, in configure
  self.plugins.configure(options, self)
File "/usr/lib/python2.6/site-packages/nose/plugins/manager.py", line 284, in configure
  cfg(options, config)
File "/usr/lib/python2.6/site-packages/nose/plugins/manager.py", line 99, in __call__
  return self.call(*arg, **kw)
File "/usr/lib/python2.6/site-packages/nose/plugins/manager.py", line 167, in simple
  result = meth(*arg, **kw)
File "/usr/lib/python2.6/site-packages/nose/plugins/cover.py", line 137, in configure
  branch=self.coverBranches, data_suffix=None)
TypeError: __init__() got an unexpected keyword argument 'branch'

Any help? Thanks

有帮助吗?

解决方案

You have the last version of nose but an old version of coverage, and nose uses features recently added in coverage.

Branch coverage support was added in coverage 3.2, and you have the version 3.0.1 (see https://crate.io/packages/coverage/).

You need to update coverage.

  • If you installed it manually, pip install -U coverage should do the trick.
  • If you installed if from your distro's repository, you should forward this to them so they fix it. In the meantime, you can either update it globally with sudo pip install -U coverage or use a virtualenv.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top