cmheisel / nose-xcover

Fork of nose.plugins.cover that enables XML output (for use with Hudson, e.g.)
MIT License
52 stars 17 forks source link

more helpful message with TypeError exception #11

Open rsyring opened 13 years ago

rsyring commented 13 years ago

I recently had two Jenkins builds fail. The output was:

+ nosetests authbwc_ta --blazeweb-package=authbwc_ta --with-coverage --cover-package=authbwc_ta,authbwc --with-xunit --with-xcoverage --cover-tests
nose.plugins.xcover: ERROR: You can not use both --with-xcover and --with-coverage. Using --with-xcover implies --with-coverage
Traceback (most recent call last):
  File "/tmp/authbwc-jenkins-venv/bin/nosetests", line 8, in <module>
    load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/core.py", line 118, in __init__
    **extra_args)
  File "/usr/lib/python2.6/unittest.py", line 816, in __init__
    self.parseArgs(argv)
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/core.py", line 135, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/config.py", line 338, in configure
    self.plugins.configure(options, self)
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 271, in configure
    cfg(options, config)
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/tmp/authbwc-jenkins-venv/lib/python2.6/site-packages/nosexcover/nosexcover.py", line 36, in configure
    raise TypeError
TypeError

Initially, it wasn't obvious to me why the build fails. I had to go look up the source code of nosexcover.py to figure it out. Once I did that, I realized the log message was above the exception. But, that was in the middle of a ton of Jenkins output, so it just didn't stand out.

I'd recommend putting the same message you have in the log message as the text for the exception.

muellert commented 12 years ago

It's definitely not only a documentation error:

$ nosetests --with-xcover 
nose.plugins.xcover: ERROR: You can not use both --with-xcover and --with-coverage. Using --with-xcover implies --with-coverage

Traceback (most recent call last):
  File "/home/zope/.virtualenvs/goe_userdb/bin/nosetests", line 9, in <module>
    load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/core.py", line 118, in __init__
    **extra_args)
  File "/usr/lib/python2.6/unittest.py", line 816, in __init__
    self.parseArgs(argv)
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/core.py", line 135, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/config.py", line 338, in configure
    self.plugins.configure(options, self)
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/plugins/manager.py", line 271, in configure
    cfg(options, config)
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/home/zope/.virtualenvs/goe_userdb/lib/python2.6/site-packages/nosexcover/nosexcover.py", line 36, in configure
    raise TypeError
TypeError
davidjb commented 12 years ago

I'm seeing the same error happening on my buildout-based install when running like so:

./bin/nosetests --with-xcover --with-xunit --cover-package=my.profiles --cover-erase

leads to the same TypeError. (I saw the other closed issue about it being a .noserc file, but I can assure you I have no such file).

Using nose 1.1.2, nosexcover 1.0.7, and Python 2.7.

EDIT: Scratch that. Found a rogue setup.cfg file in my package with nose settings. Maybe that's worth adding to doco.

p00j4 commented 8 years ago

I also ran into this: https://github.com/cmheisel/nose-xcover/issues/28 @davidjb could you please elaborate your solution with setup.cfg file? i'm newbie in the world of python, and don't get like "to find & delete this file or something else" ?

EDIT: ok, got it, yes it looks like removing the "[nosetests]" entry from setup.cfg file, resolves that. thanks A lot for giving direction to my wild trials 👍