大概想测一下这个界面 :

pytest-qt 测试模态窗体
image.png

步骤分别是 :

  1. 点击 开始扫描 弹出 选择路径窗口 ;

  2. 勾选路基 ;

3.点击确定 ;

需要测试的函数 :

pytest-qt 测试模态窗体
image.png

测试函数 :

pytest-qt 测试模态窗体
image.png

可以发现断言失败 .

pytest-qt 测试模态窗体
image.png

官方文档 : 测试模态窗体.

https://pytest-qt.readthedocs.io/en/latest/note_dialogs.html

用的是官方的 monkeypatch 方式 .

大致意思就是替换 FileSelectPathDialog 类的exec函数.

相关文章:

  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-08-18
  • 2021-05-30
猜你喜欢
  • 2019-09-22
  • 2021-12-26
  • 2022-01-04
  • 2022-12-23
  • 2021-05-19
相关资源
相似解决方案