[英]How can I organise my unit tests to run in a particular order in Python Nosetests
I have a set of 50 odd unit tests scheduled to be run/executed using Python Nose-tests. 我有一组50个计划使用Python鼻子测试运行/执行的奇数单元测试。
These 50+ unit tests are written in an order and such that, they leverage the output of the previous one, when run as one test suite. 这50多个单元测试是按顺序编写的,因此当作为一个测试套件运行时,它们可以利用前一个的输出。
However, Nose-tests seems to pick a order of its own and doesn't really care for the order I've configured the unit tests. 但是,鼻子测试似乎选择了自己的顺序,并不真正在意我为单元测试配置的顺序。
I've looked around for possible answers/references on stack overflow, but without success. 我到处寻找关于堆栈溢出的可能答案/参考,但是没有成功。 Can anyone point me to any existing configuration parameters or Nose-tests Flags that can be set, to have the unit tests within the test suite to be executed in a given order? 谁能指出我可以设置的任何现有配置参数或鼻子测试标志,以使测试套件中的单元测试按给定顺序执行?
Thanks in advance. 提前致谢。
Two answers, 两个答案
def test_01_foo(): assert foo() def test_02_bar(): assert bar()
Nose runs the tests in a specific order: 鼻子按特定顺序运行测试:
Like py.test, nose runs functional tests in the order in which they appear in the module file. 像py.test一样,鼻子按照它们在模块文件中出现的顺序运行功能测试。 TestCase-derived tests and other test classes are run in alphabetical order. TestCase派生的测试和其他测试类以字母顺序运行。
More here: nose.readthedocs.io 更多内容请参见 : nas.readthedocs.io
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.