Setuptools & nosetests oddness

24 April 2008 (updated 20 September 2018)

Looks like using setuptools's test runner (eg, run python 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 test borked with " 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

with-coverage = 1
cover-package = cogen

I can do:

test = nosetests --cover-package=cogen --with-coverage

in setup.cfg.

This entry was tagged as nose python setuptools testing