Mark Dodrill
Mark Dodrill

Reputation: 1

NOSE reports KeyError for command line parameter, can't figure out why

I am using NOSE version 1.3.4 on Ubuntu Linux, with Python 2.7. I am having trouble getting what should be a valid command line to be accepted by NOSE. I repeatedly get this error:

Traceback (most recent call last):
  File "bin/nosetests", line 86, in 
    sys.exit(nose.run_exit())
  File "/home/testrunner/.virtualenvs/bqt/parts/nose/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/home/testrunner/.virtualenvs/bqt/parts/nose/nose/core.py", line 145, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/home/testrunner/.virtualenvs/bqt/parts/nose/nose/config.py", line 346, in configure
    self.plugins.configure(options, self)
  File "/home/testrunner/.virtualenvs/bqt/parts/nose/nose/plugins/manager.py", line 288, in configure
    cfg(options, config)
  File "/home/testrunner/.virtualenvs/bqt/parts/nose/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/home/testrunner/.virtualenvs/bqt/parts/lib/src/f5test/noseplugins/extender/__init__.py", line 29, in simple
    result = meth(*arg, **kw)
  File "/home/testrunner/.virtualenvs/bqt/parts/lib/src/f5test/noseplugins/testconfig.py", line 109, in configure
    exec('config%s = %s' % (ns, val))
  File "", line 1, in 
**KeyError: 'stages'**

I've tried specifying the command line in a BASH script (which is how I eventually need it to work) and directly from the command line, same result. I have verified that my .yaml parameters are correct and the path to my test is correct.

Here are the different command lines I've tried, all with the same exact error. Seems like some sort of " or ' expansion issue, but I cannot figure out why.

1) bin/nosetests -sv --log-config=logging.conf --console-redirect --tc 'stages.enabled:"0"' -A 'rank > 0 and rank < 11 and module' --tc-file=config/users/mgmt.yaml tests/version_compare.py

2) bin/nosetests -sv --log-config=logging.conf --console-redirect --tc stages.enabled:0 -A 'rank > 0 and rank < 11 and module' --tc-file=config/users/mgmt.yaml tests/version_compare.py

3) bin/nosetests -sv --log-config=logging.conf --console-redirect --tc stages.enabled:"0" -A 'rank > 0 and rank < 11 and module' --tc-file=config/users/mgmt.yaml tests/version_compare.py

4) bin/nosetests -sv --log-config=logging.conf --console-redirect --tc stages.enabled:0 --tc-file=config/users/mgmt.yaml tests/version_compare.py

I've removed all possible parameters to eliminate variables, but no luck. I am not able to find a NOSE command line parameter to use to have it echo out what it thinks the command line is.

Please help if you can. I've spent many hours trying to figure this out.

Upvotes: 0

Views: 563

Answers (1)

scope
scope

Reputation: 1997

First of all, try using --tc-exact instead of --tc (latter seems to break stages.enabled into two separate keys).

Also, I see there in the code such comment:

# BUG: Breaks if the config value you're overriding is not
# defined in the configuration file already. TBD

So, check if you have stages.enabled declared in your config/users/mgmt.yaml

Hope that helps!

Upvotes: 1

Related Questions