简体   繁体   English

从nose.run()或nose.main()指定属性

[英]Specifying attributes from nose.run() or nose.main()

I have a project for which I have traditionally run my unit tests with a make file like 我有一个项目,该项目通常使用make文件(例如

NOSE_CMD=nosetests --config setup.cfg

test:
    $(NOSE_CMD) 

test-fast:
    $(NOSE_CMD) -A "not slow and not valuations"

test-slow:
    $(NOSE_CMD) -A "slow or valuations"

and a setup.cfg like this 和这样的setup.cfg

[nosetests]
all-modules=1
with-doctest=1
verbosity=3
processes=3
process-timeout=600
exe=1

Now I'm trying to run this all from a Python script. 现在,我试图从Python脚本运行所有这些。 My first attempt to mimic the behavior of 'make test-fast' from above was 我第一次尝试从上面模仿“快速测试”的行为是

argv = ['-A "not slow and not valuations"']
nose.run(argv=argv)

This doesn't work, though. 但是,这不起作用。 It's running all of my tests, regardless of attributes. 它正在运行我所有的测试,而与属性无关。 Is this because I need to activate the attributes plug-in manually somehow? 这是因为我需要以某种方式手动激活属性插件吗?

Much thanks for any help. 非常感谢您的帮助。

Try: 尝试:

argv = ['-A', 'not slow and not valuations']
nose.main(argv=argv)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM