![](/img/trans.png)
[英]how can I pass argument(s) through nose.run that can be picked up by list of python test files containing test methods
[英]How can I pass a list of unit test python file names(path\test.py) to nose.run() method to execute all the tests in all these files?
我有一个python文件名列表(名称包括绝对路径。例如,folder1 \\ test1.py)。 每个文件都包含一组单元测试用例。 我想将此列表传递给nas.run()方法,以便可以执行这些文件中的所有测试。 谁能帮我用python代码解决这个问题。
列表中的文件不必来自同一文件夹。 给出了绝对文件路径以及每个文件名。 如果可以保存鼻子.run()的结果,这将很有帮助。(非强制性要求)
如果所有测试都位于同一文件夹中,则可以实际运行测试,如下所示
nose.run(argv=['folder', 'test_suite1', 'test_suite2'])
其中folder
是同时存在test_suite1.py
和test_suite2.py
的文件夹。
为了捕获运行结果,我使用了“ --debug-log”参数。 因此,您的最终命令变为
nose.run(argv=['folder', 'test_suite1', 'test_suite2', '--debug-log', '/home/loglocation/logfile.log'])
如果测试套件位于不同的位置,我没有花太多时间在如何运行方面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.