python - 在所有子目录中运行 nosetests

标签 python python-3.x nose

我可以使用 nosetestsworkflow 文件夹中运行测试:

workflow maks$ nosetests
..........
----------------------------------------------------------------------
Ran 10 tests in 0.093s

OK

我的测试在 test 文件夹中:

workflow maks$ ls
__pycache__     iterations.py       test
data            iterationsClass.py  testData
env         iterationsClass.pyc

但是当我移动到父目录时:

(py3env)Makss-Mac:workflow maks$ cd ..

它找不到测试。

(py3env)Makss-Mac:Packages maks$ nosetests

----------------------------------------------------------------------
Ran 0 tests in 0.005s

OK

那么如何在所有子目录下进行nosetest搜索测试呢?

最佳答案

如果你通过将 __init__.py 放入你的 workflow 文件夹成为一个模块,nose 应该能够找到你的测试。

关于python - 在所有子目录中运行 nosetests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19852548/

相关文章:

python - 为什么 "mutable default argument fix"语法这么难看,python 新手问

python - 在LinuxMint上安装python2.6

python - 如何用for循环改进子图部分?

c# - 如何使用 IronPython 中的包调用 Python 脚本?

python - 倒数计时器给我负数

python - 什么在第五行之后切片行

正则表达式提取首字母缩略词

Python 单元测试结果文件

Python nosetest 不起作用,但直接运行它可以使用 matplotlib 的 @image_comparison

python - nose.collector 在哪里寻找测试?