django-nose
django-nose copied to clipboard
Correctly support Django options
I'm not entirely sure how the _get_options stuff functions, but our custom code does something slightly different, which actually makes --noinput/etc work for us::
def _get_options():
"""Return all nose options that don't conflict with django options."""
cfg_files = nose.core.all_config_files()
manager = nose.core.DefaultPluginManager()
config = nose.core.Config(env=os.environ, files=cfg_files, plugins=manager)
config.plugins.addPlugins(list(_get_plugins_from_settings()))
cmd_opts = tuple(Command.option_list)
options = tuple(config.getParser()._get_all_options()) + cmd_opts
django_opts = [opt.dest for opt in BaseCommand.option_list] + ['version']
return tuple(o for o in options if o.dest not in django_opts and
o.action != 'help')
Interesting alternative. I'll have to investigate if it still works.
April 2, 2012 version of runner.py is about 0268292 - things have changed, but _get_options is still fairly similar to this code.