pytest --ignore用法

文件目录结构如下:

├── demo

  ├── all
  │   ├── a_a_test
  │   │   └── test_1.py
  │   ├── b_a_test
  │   │   └── test_2.py
  │   └── c
  │   └── test_2.py

 

一、忽略 c 文件夹下的脚本:

# demo.py

pytest --ignore=all/c 

# c后面不要有/,也不要写成c/*

# 注意,多个目录忽略,加多个--ignore即可,中间用空格做间隔。

二、忽略某一类脚本

# demo.py

pytest --ignore-glob='*_a_test'

# 会忽略a_a_test 和 b_a_test 目录下的脚本

 

posted on 2020-09-29 09:16  101欢欢鱼  阅读(1329)  评论(0编辑  收藏  举报

导航