views:

40

answers:

1

Hi,

I am able to override multiple config parameters using the nose-testconfig plugin only if I pass the overriding parameters on the command line, e.g.

nosetests -c nose.cfg -s --tc=jack.env1:asl --tc=server2.env2:abc

But when I define the same thing inside nose.cfg, than only the value for the last parameter is modified. e.g.

tc = server2.env2:abc
tc = jack.env1:asl

I checked the plugin code. It looks fine to me. Here is part of the plugin code:

    parser.add_option(

        "--tc", action="append", 
        dest="overrides",
        default = [],
        help="Option:Value specific overrides.")

configure:

    if options.overrides:
        self.overrides = []
        overrides = tolist(options.overrides)
        for override in overrides:
            keys, val = override.split(":")
            if options.exact:
                config[keys] = val
            else:                    
                ns = ''.join(['["%s"]' % i for i in keys.split(".") ])
                # BUG: Breaks if the config value you're overriding is not
                # defined in the configuration file already. TBD
                exec('config%s = "%s"' % (ns, val))

Let me know if any one has any clue.

A: 

Please find my nose.cfg file below:

[nosetests] verbosity=2

tc-file = setup_config.py

tc-format = python

all-modules = True

tc = server2.env2:abc

tc = jack.env1:asl


and my config file looks like:

[server2]

env2=server2

[jack]

env1=server1


In the above example only jack.env1:as1 value is effective (i.e last value). But when I specify the same on command line than both values are effective

Jaikit