diff options
Diffstat (limited to 'tests/test_gui.py')
| -rw-r--r-- | tests/test_gui.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/test_gui.py b/tests/test_gui.py index 95f9afb..16b83c0 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -23,12 +23,13 @@ import importlib.machinery # noqa: E402 import importlib.util # noqa: E402 import sys # noqa: E402 import tempfile # noqa: E402 +import time # noqa: E402 import unittest # noqa: E402 ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..") sys.path.insert(0, ROOT) -from PyQt6.QtCore import QObject, pyqtSignal # noqa: E402 +from PyQt6.QtCore import QCoreApplication, QEvent, QObject, QProcess, pyqtSignal # noqa: E402 from PyQt6.QtWidgets import QApplication # noqa: E402 from sb_builder import VERSION, config # noqa: E402 @@ -156,6 +157,30 @@ class SmokeTest(unittest.TestCase): self.assertEqual(w.conn.text(), "● VM off") self.assertFalse(w.vm_btn.isHidden()) + def test_close_jobs_tab_while_following(self): + # regression: the follow process ended after the tab was deleted, its + # finished slot touched dead widgets and PyQt aborted the app + w, remote = self.window(jobs=({"jobs": [JOB]}, None)) + procs = QObject() + self.addCleanup(procs.deleteLater) + + def follow(jid, offset): + p = QProcess(procs) + p.start("sleep", ["5"]) + return p + + remote.follow = follow + w.poll_jobs() + jobs = w.open_jobs() + jobs.select(JOB["id"]) + self.assertIsNotNone(jobs.proc) + w._close_tab(w.tabs.indexOf(jobs)) + QCoreApplication.sendPostedEvents(None, QEvent.Type.DeferredDelete.value) + end = time.monotonic() + 1 + while time.monotonic() < end: # let the killed process report in + app.processEvents() + self.assertIsNone(w.jobs_tab) + def test_log_carriage_return(self): w, _ = self.window() jobs = w.open_jobs() |
