I have a TestMain.py that inits and runs the Nose tests and I am trying to enable code coverage within it. The tests are currently loaded as follow:
if __name__ == '__main__':
# Some initialization code here, so command-line cannot be used
# Coverage configuration here
test_loader = nose.loader.TestLoader(workingDir = './tests')
nose.core.TestProgram(testLoader = test_loader)
The only "documentation" I found about the plugin is this and it's terrible: https://nose.readthedocs.org/en/latest/plugins/cover.html. No hints at all about what the methods expect, in what order they must be called, and the source code is of no use (I am supposed to supply a parser, what's a parser?)
I need to configure options (cover-package and cover-erase) and enable html reporting.
Can someone point me to a comprehensive doc about this API or demonstrate how to use this plugin?
Thank you!
I have solved my problem using a setup.cfg file as described here: http://nose.readthedocs.org/en/latest/api/commands.html. Nose will pick up the file whether the tests are started from the command-line or within the API. Shame on Nose developpers for providing such incomplete and low quality documentation.