setuptools + nosetests oddness

Looks like using setuptools’s test runner (eg, run python setup.py test) with the nose.collector has some weird issues – well, unexpected, for me at least.

I was using nose with coverage via –with-coverage option to get some cover reports. But setup.py test borked with “setup.py: error: no such option: –cover-package”. After some digging in the sources i’ve found that some plugins aren’t compatible with setuptools’s test runner – you can’t run post test hooks with that runner apparently (sadly, the coverage plugin is one of them). I wish setuptools had a option to ignore bogus options and show only a warning – well, on second thought, that’s not setuptools related at all, the error is raised from optparse.

Luckily, setuptools has aliases for commands and instead of

[nosetests]
with-coverage = 1
cover-package = cogen

I can do:

[aliases]
test = nosetests --cover-package=cogen --with-coverage

in setup.cfg.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*