手动将测试套件添加到鼻子 [英] Manually adding test suite to nose

查看:93
本文介绍了手动将测试套件添加到鼻子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想手动创建一个测试套件,而不是使用测试发现(仅在一个模块中,其他模块应该使用发现).我发现了如何在单元测试中做到这一点,但是我不确定如何将其转移到鼻子上以及如何与发现相结合. 鼻子文档没有示例,我不明白我应该如何使用它们. 有人可以举个例子吗?

I want to create a test suite manually instead of using test discovery (only in one module, the others should use discovery). I found how I can do this in unittests, but I'm not sure how to transfer that to nose and how it mixes with the discovery. The nose docs don't have examples and I don't understand how I'm supposed to use them. Could somebody please give me an example?

详细信息: 我有一些测试类,我想在其中使用不同的参数多次运行每种方法.理想情况下,还将测试名称更改为可读的名称.我尝试过测试生成器,但是它们有很多问题

Details: I have test classes where I want to run each method a few times with different parameters. Ideally also changing the test names to something readable. I tried test generators, but they are quite buggy.

推荐答案

让鼻子测试套件的路径,它将执行该路径,而不是使用Nose的测试发现.

Give nosetests the path to your suite, and it will be executed instead of using Nose's test discovery.

此命令:

nosetests 

执行自动测试发现.

这些命令:

nosetests /path/to/file.py
nosetests /path/to/directory

分别在file.pydirectory中运行测试.

或者,您可以在特定目录中开始自动发现:

Alternatively, you could start auto discovery in a specific directory:

nosetests -w /path/to/directory

查看 nosetests -h以获得完整的选项列表.

这篇关于手动将测试套件添加到鼻子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆