无法在nosetests中使用nose-testconfig 0.6插件传递多个覆盖参数
只有当我在命令行上传递覆盖参数,例如,
nosetests -c nose.cfg -s --tc=jack.env1:asl --tc=server2.env2:abc
但是当我在nose.cfg 中定义相同的内容时,仅修改最后一个参数的值。例如
tc = server2.env2:abc
tc = jack.env1:asl
我检查了插件代码。对我来说看起来不错。这是插件代码的一部分:
parser.add_option(
"--tc", action="append",
dest="overrides",
default = [],
help="Option:Value specific overrides.")
配置:
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))
如果有人有任何线索,请告诉我。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请在下面找到我的nose.cfg 文件:
我的配置文件如下所示:
在上面的示例中,只有jack.env1:as1 值有效(即最后一个值)。但是当我在命令行上指定相同的值时,这两个值都有效
Please find my nose.cfg file below:
and my config file looks like:
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