Python的单元测试发现没有找到我的测试!`python -m unittest discover`没有发现测试
我一直在使用鼻子来发现我的单元测试,它工作正常。从我的项目的顶级水平,如果我跑nosetests
我得到:
Ran 31 tests in 0.390s
现在的Python 2.7单元测试has discovery,我使用
python -m unittest discover
试过,但我得到
Ran 0 tests in 0.000s
我的目录结构是:
myproj/
reporter/
__init__.py
report.py
[other app modules]
tests/
__init__.py
test-report.py
[other test modules]
你有什么想法为什么unittest的发现算法找不到测试?
我使用Python 2.7.1和1.0.0的鼻子在Windows 7
我刚刚发现,如果我将'test-report.py'重命名为'test_report.py',就会发现测试。除非有人能够说明这一点,否则我会向unittest模块维护人员提交一个错误报告。 – blokeley 2011-02-23 09:56:11
我感到惊讶,因为测试报告是不可导入的,所以这在鼻子中起作用。 – dbn 2013-01-16 20:55:31