I am trying to write a custom plugin for nosetests ( a plugin to run as a custom selector) which works fine and i can use it by calling
nose.run(plugins=[CustomSelectorPlugin()])
However i also want to run nose with the built-in xunit plugin but I am unsure as to how to do this.
I have tried
nose.main(plugins=[CustomSelectorPlugin()], argv=['--with-xunit'])
and calling my program with --with-xunit option but these do not seem to work (well, everythion runs fine but there is no nosetests.xml generated)
How do i run both my plugin and xunit pragmatically?
Thanks
Solved the problem
I needed to call
nose.run(addplugins=[CustomSelectorPlugin()])
note the addplugins
(as opposed to plugins
) call. This allows me to call my program with command line arg --with-xnuit
. Just having plugins
meant the default plugin manager was not invoked/called/was overridden.
Also I should mention to be able to specify the args in code the first arg in argv is ignored by nose so something like this should be used:
nose.run(addplugins=[CustomSelectorPlugin()], argv=['foo', '--with-xunit'])
Hope this helps future googlers