nose-devs/nose — Issue #218: No-arguments invocation does not use Config.testNames from c'tor
Author: jpellerin
Created: 2011-12-14 16:04:05+00:00
State: open

nose.config.Config.configure seems to intend that the initial
self.testNames (from the c'tor) be used as the default test name for
no-arguments command line invocation. That a sensible feature (I was
looking for a feature just like that, in fact). However, if that is the
intent, it looks like it's broken, since slicing does not raise IndexError,
so the except suite here (from .configure()) never happens and the default
.testNames is always set empty in the no-commandline-args case:

try:
self.options, self.testNames = options, args[1:]
except IndexError:
self.options = options

What steps will reproduce the problem?

I don't have a test case written, but it should work to write a script
("wrapper-script.py") that does something like:

cfg_files = nose.config.all_config_files()
config = nose.config.Config(files=cfg_files,
plugins=DefaultPluginManager())
config.testNames = ('/path/to/proejct',)
nose.core.main(config=config)

And then put that wrapper script somewhere other than /path/to/project, and
run wrapper-script.py without arguments.

What is the expected output? What do you see instead?

Got: Running wrapper-script.py without args runs the tests from the current
working directory, not the tests in the directory listed in config.testNames

Expected: runs all the tests from config.testNames

Adding a "raise IndexError" immediately after the "try:" above makes the
no-args test-wrapper.py show the expected behaviour

What version of the product are you using? On what operating system?

http://python-nose.googlecode.com/svn/branches/0.10.0-stable revision 315,
Ubuntu Linux.

Please provide any additional information below.

Google Code Info:
Issue #: 92
Author: j...@pobox.com
Created On: 2007-09-11T01:04:17.000Z
Closed On: 2007-09-14T19:49:04.000Z