test-gui
GUIアプリケーションの動作試験・デバッグを自動で行う
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Test and Debug GUI
This skill helps in testing and debugging gwexpy.gui.
Instructions
-
Run Automated Tests:
- Run tests specifically marked for GUI (usually requiring
pytest-qt). - Command:
pytest -m guiorpytest tests/gui/. (Adjust based on actual markers/folders). - Check
scripts/run_gui_tests.shif it exists and run it.
- Run tests specifically marked for GUI (usually requiring
-
Debug Crashes:
- If the GUI crashes (e.g. segmentation fault), look for logs or run with
gdbif necessary/possible. - Check typical PyQt issues: Thread safety (updating UI from background thread), signal/slot mismatches, object lifecycle (Python garbage collecting C++ objects).
- If the GUI crashes (e.g. segmentation fault), look for logs or run with
-
Interactive Debugging:
- Since this is an agent, "interactive" means adding print debugging or logging to the code and running it to capture output.
- Focus on
gwexpy/gui/main_window.pyor relevant widget files.
Best Practices
-
Avoid Binding Conflicts: Use
qtpyfor imports in test files (e.g.from qtpy import QtWidgets). -
Environment Variables: If multiple top-level bindings are installed, enforce consistency:
-
export QT_API=pyqt5 -
export PYTEST_QT_API=pyqt5
-
-
Handling Blocking Windows (plt.show):
-
When testing code that calls
plt.show()orapp.exec_(), useQTimerto close it automatically. -
Example:
from qtpy.QtCore import QTimer # ... inside test ... # Close active window after 100ms QTimer.singleShot(100, plt.close) # Or for raw Qt widgets: # QTimer.singleShot(100, widget.close) # Then call the blocking function plt.show()
-
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!