← Back to team overview

openstack team mailing list archive

Re: run_tests.sh (-x | --stop) is broken, optparse and nosetests

 

Hi!

On 02/14/2012 07:29 PM, Joe Gordon wrote:
> Hi Developers,
> 
> I have been looking at https://bugs.launchpad.net/nova/+bug/931608,
> "run_tests.sh (-x | --stop) is broken."  A fix was committed but it only
> stopped "./run_tests.sh -x" from failing, and not restoring the
> "./run_tests.sh -x" functionality.
> 
> "run_tests.sh (-x | --stop)" is a nosetests parameter which gets passed
> in via nova/testing/runner.py:367.  sys.argv for nova/testing/runner.py,
> takes two sets of parameters nova parameters and any arbitrary nosetests
> parameter.  The nova flags (hide-elapsed etc..) are handled via 
> 'flags.FLAGS.register_cli_opt' and the nosetest parameters are generated
> from the args return value from optparse
> (nova/openstack/common/cfg.py:768:   "(values, args) =
> self._oparser.parse_args(self._args)" ).
> 
> The problem is when optparse sees an unknown flag (such as '-x') it
> terminates the program without throwing an error.  Additionally the
> 'args' return value doesn't contain the flags just flag arguments (only
> 'a' in '-x a').  So there is no way of passing on just the unknown flags
> to nosetest.  Additionally nosetest uses optparse itself so if you pass
> in sys.argv to nosetest with a nova argument set will case the tests to
> break too.<member:jog0>
> 
> 
> While I can write a hack to look for 'hide-elapsed' or other nova flags,
> I am looking for more elegant solutions.  Should this solution live in
> the cfg module?

So - you and I may be working in parallel here, but in different directions.

I'm currently working on getting install_venv/with_venv replaced by tox.
That may not sound related to your issue, but step #2 on my list of that
project is to get nova/testing/runner.py replaced by pure nosetests
(with the openstack.nose_plugin installed so that we can get our pretty
output)

My vote is - gimme a hand with that, and we can then pass things
straight through to their proper place, and we can stop carrying a
custom test runner.

Monty


Follow ups

References