8239:59a9a658618c | 8240:93b8a353c4bf |
---|---|
10 import unittest | 10 import unittest |
11 import sys | 11 import sys |
12 import time | 12 import time |
13 import re | 13 import re |
14 import os | 14 import os |
15 import contextlib | |
15 | 16 |
16 from PyQt5.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot | 17 from PyQt5.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot |
17 from PyQt5.QtGui import QColor | 18 from PyQt5.QtGui import QColor |
18 from PyQt5.QtWidgets import ( | 19 from PyQt5.QtWidgets import ( |
19 QWidget, QDialog, QApplication, QDialogButtonBox, QListWidgetItem, | 20 QWidget, QDialog, QApplication, QDialogButtonBox, QListWidgetItem, |
1228 @type QCloseEvent | 1229 @type QCloseEvent |
1229 """ | 1230 """ |
1230 event.accept() | 1231 event.accept() |
1231 | 1232 |
1232 for editor in self.__editors: | 1233 for editor in self.__editors: |
1233 try: | 1234 with contextlib.suppress(Exception): |
1234 editor.close() | 1235 editor.close() |
1235 except Exception: # secok | |
1236 # ignore all exceptions | |
1237 pass | |
1238 | 1236 |
1239 | 1237 |
1240 class QtTestResult(unittest.TestResult): | 1238 class QtTestResult(unittest.TestResult): |
1241 """ | 1239 """ |
1242 A TestResult derivative to work with a graphical GUI. | 1240 A TestResult derivative to work with a graphical GUI. |