鼻子无法在Ubuntu中找到测试 [英] Nose unable to find tests in ubuntu

查看:90
本文介绍了鼻子无法在Ubuntu中找到测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何原因导致Nose无法在Ubuntu 9.04中找到测试?

Is there any reason why Nose wouldn't be able to find tests in Ubuntu 9.04?

我在python 2.5.4中使用鼻子0.11.1.
只有明确指定文件名,我才能运行测试. 如果我没有指定文件名,它只会显示 0个测试.

I'm using nose 0.11.1 with python 2.5.4.
I can run tests only if I explicitly specify the filename. If I don't specify the filename it just says, 0 tests.

同一项目在我的Mac上运行正常,因此我很沮丧!

The same project runs tests fine on my Mac, so I'm quite stumped!

推荐答案

一些相关的内容,如果您要在目录之外运行测试,即

Some what related, if you're running tests off of a directory i.e

nosetests ... tests/

其中tests是我的测试文件夹的名称,并且在.py模块之一中具有单独的python测试功能...您的功能必须以'test'开头,以便进行鼻子测试才能将其识别为您想要的测试跑步.

where tests is the name of the folder with my tests, and have separate python test functions in one of the .py modules... Your functions have to start with 'test' for nosetests to recognize that as a test you want to run.

例如:

 def test_something():
    ...

在此目录中执行时,nosetestest将运行此功能

nosetests will run this function when executed in this directory while

 def somethin_to_test():
    ...

不会.

这篇关于鼻子无法在Ubuntu中找到测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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