From 110346ca4933cce505f37677f21682ec1ef0043d Mon Sep 17 00:00:00 2001 From: MeditationDuck Date: Wed, 18 Sep 2024 14:49:41 +0200 Subject: [PATCH] :pencil2: fix --- wake/testing/pytest_plugin_multiprocess.py | 8 +------- wake/testing/pytest_plugin_multiprocess_server.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/wake/testing/pytest_plugin_multiprocess.py b/wake/testing/pytest_plugin_multiprocess.py index 386f3fa2..84b881f0 100644 --- a/wake/testing/pytest_plugin_multiprocess.py +++ b/wake/testing/pytest_plugin_multiprocess.py @@ -27,7 +27,6 @@ ) from wake.testing.coverage import CoverageHandler from wake.utils.tee import StderrTee, StdoutTee -import websocket class PytestWakePluginMultiprocess: @@ -114,11 +113,6 @@ def _exception_handler( finally: self._setup_stdio() self._conn.send(("exception_handled",)) - - # def pytest_keyboard_interrupt(self, excinfo: pytest.ExceptionInfo[BaseException]): - # print("Keyboard interrupt") - # self.keyboard_interrupt = True - # self._queue.put(("keyboard_interrupt", self._index)) def pytest_configure(self, config: pytest.Config): self._f = open(self._log_file, "w") @@ -194,7 +188,7 @@ def coverage_callback() -> None: def sigint_handler(signum, frame): self.keyboard_interrupt = True self._queue.put(("keyboard_interrupt", self._index)) - pytest.exit(returncode=0) + pytest.exit("Keyboard interrupt", returncode=0) signal.signal(signal.SIGINT, sigint_handler) diff --git a/wake/testing/pytest_plugin_multiprocess_server.py b/wake/testing/pytest_plugin_multiprocess_server.py index 55e0e848..6d107c30 100644 --- a/wake/testing/pytest_plugin_multiprocess_server.py +++ b/wake/testing/pytest_plugin_multiprocess_server.py @@ -271,7 +271,12 @@ def pytest_runtestloop(self, session: pytest.Session): ) elif msg[0] == "pytest_sessionfinish": if progress is not None: - text = f"#{index} finished [green]✓[/green]" if msg[2] == 0 or keyboard_interrupt[index] else f"#{index} failed [red]✗[/red]" + if keyboard_interrupt[index]: + text = f"#{index} skipped [yellow]⚠[/yellow]" + elif msg[2] == 0: + text = f"#{index} finished [green]✓[/green]" + else: + text = f"#{index} failed [red]✗[/red]" progress.update(tasks[index], description=text) self._processes.pop(index) @@ -286,12 +291,12 @@ def pytest_runtestloop(self, session: pytest.Session): elif msg[0] == "keyboard_interrupt": keyboard_interrupt[index] = True - if False not in keyboard_interrupt: + if True in keyboard_interrupt: raise KeyboardInterrupt finally: + print("") for report in reports: session.config.hook.pytest_runtest_logreport(report=report) - return True def pytest_terminal_summary(self, terminalreporter, exitstatus, config):