Python 从nose.run()或nose.main()指定属性
我有一个项目,我传统上使用make文件运行我的单元测试,比如Python 从nose.run()或nose.main()指定属性,python,unit-testing,plugins,nose,Python,Unit Testing,Plugins,Nose,我有一个项目,我传统上使用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" 还有像这样的setup.cfg [nosetests] all-modules=1 w
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"
还有像这样的setup.cfg
[nosetests]
all-modules=1
with-doctest=1
verbosity=3
processes=3
process-timeout=600
exe=1
现在,我尝试从Python脚本运行这一切。我第一次尝试从上面模仿“快速测试”的行为是
argv = ['-A "not slow and not valuations"']
nose.run(argv=argv)
但这不管用。它正在运行我的所有测试,不管属性如何。这是因为我需要手动激活属性插件吗
非常感谢您的帮助。试试:
argv = ['-A', 'not slow and not valuations']
nose.main(argv=argv)