Skip to content

Commit

Permalink
✏️ fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MeditationDuck committed Sep 18, 2024
1 parent 2d12e0c commit 110346c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 1 addition & 7 deletions wake/testing/pytest_plugin_multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
)
from wake.testing.coverage import CoverageHandler
from wake.utils.tee import StderrTee, StdoutTee
import websocket


class PytestWakePluginMultiprocess:
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand Down
11 changes: 8 additions & 3 deletions wake/testing/pytest_plugin_multiprocess_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 110346c

Please sign in to comment.