Skip to main content
 首页 » 编程设计

python之如何使用 Nose 忽略特定文件夹中的所有测试

2024年10月25日8zhoujg

我按以下方式组织了许多单元测试:

test_dir/ 
  test_important1.py 
  test_important2.py 
  test_important3.py 
  .... 
  basic tests/testA1.py 
              testA2.py 
              .... 
              __init__.py 

我想在 test_dir 目录本身中运行所有测试,不包括 基本测试 中的测试。

如何实现?

谢谢!

请您参考如下方法:

nose-exclude 引入了一个 --exclude-dir 选项:

nosetests --exclude-dir="basic tests/"