当前位置: 首页 > news >正文

Pytest框架直接右键运行 testcase.py,不执行最外层conftest

随笔记录

目录

1. 背景介绍

2. workaround method

2.1 通过命令行执行 某个测试用例


1. 背景介绍

Pytest 框架结构如下:
TestCases:conftest.pyInstanta:    conftest.pytest_instanta_tcpdump_pack_len.py# 当直接右键直接 运行 test_instanta_tcpdump_pack_len.py 时,只运行Instanta\conftest.py,
不运行 TestCases\conftest.py.

2. workaround method

2.1 通过命令行执行 某个测试用例

# 命令行执行某个测试用例
# pytest -s .\TestCases\Instanta|test_instanta_tcpdump_Pack_length.py PS D:\Work\Git\NDPPBC1Card\BC1Card> 
PS D:\Work\Git\NDPPBC1Card\BC1Card> pytest -s .\TestCases\Instanta\test_instanta_Pack_Length.py
Send Server IP: 192.168.2.122
Send Server User: root                              
Send Server Password: 2023@Yusur122                 
Send Server dirVer: /magx/version/BC/BC-V1.0.7.1    
Send Server dirSdk: /magx/version/NDPP/NDPP-V1.0.7.1
Send Server scriptPath: /magx/test/BC1Card          
Send Server version: 1.0.7.1
Send Server Firmware_version: 04210007
Send Server Firmware_date: 24070301
Send Server cardType: X1100
======================================================================================================= test session starts =======================================================================================================
platform win32 -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0
......
......
......================================================================================================= 1 passed, 4 warnings in 17.11s ================================================================================================== 
PS D:\Work\Git\NDPPBC1Card\BC1Card> 

到此暂时可以规避此问题。后续跟进中.....


http://www.mrgr.cn/news/4200.html

相关文章:

  • Linux文件链接
  • 国内用户快速部署Scoop@一键加速安装scoop@Deploy-ScoopForCNUser
  • 权威解读!中国数字经济发展指数报告2023(PDF限免下载)
  • python创建项目环境及项目打包
  • 微软AI人工智能认证有哪些?
  • [游戏开发] LuaTable转string存读二进制文件
  • 数据结构(邓俊辉)学习笔记】优先级队列 04——完全二叉堆:插入与上滤
  • vue2 动态组件
  • 【Qt】输入类控件QLineEdit
  • Springboot3 HttpUtil post、get请求
  • 【操作系统 / 系统编程】2025 秋招超详细复习指南 - 基于 Linux 环境的全面复习 - 持续更新(目前1.3w字)
  • presto 分页
  • Element-ui table进阶使用
  • 设计模式六大原则(四)--接口隔离原则
  • 如何使用AWS EC2资源?
  • 【经典算法】BFS_最短路问题
  • 将 hugo 博客搬迁到服务器
  • javaEE中自定义注解以及注解的解析
  • 【HTML】从0开始构建HTML页面
  • 探索Ruby在物联网世界的无限可能:智能连接与创新应用