Skip to content

Commit

Permalink
fix: issue where CTRL-C did not exit tests [APE-1223] (ApeWorX#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Jul 24, 2023
1 parent d477765 commit 6b882e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ape/api/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,8 @@ def _signal_handler(signum, frame):
signal(SIGTERM, _signal_handler)

def disconnect(self):
"""Stop the process if it exists.
"""
Stop the process if it exists.
Subclasses override this method to do provider-specific disconnection tasks.
"""

Expand Down
5 changes: 5 additions & 0 deletions src/ape/pytest/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ def pytest_exception_interact(self, report, call):
if capman:
capman.resume_global_capture()

if type(call.excinfo.value) in (SystemExit, KeyboardInterrupt):
# This will show the rest of Ape Test output as if the
# tests had stopped here.
pytest.exit("`ape test` exited.")

def pytest_runtest_setup(self, item):
"""
By default insert isolation fixtures into each test cases list of fixtures
Expand Down

0 comments on commit 6b882e8

Please sign in to comment.