From 5bcbb58ac40cf476c07e7a3fa1ef70d84cf9432e Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Wed, 15 Aug 2018 21:21:56 +0200 Subject: [PATCH] Do not display failure messages when the pytest is interrupted Restarting the test suite on filesystem changes should not result to emitting a failure message. --- pytest_watch/watcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pytest_watch/watcher.py b/pytest_watch/watcher.py index f69497f..2888649 100644 --- a/pytest_watch/watcher.py +++ b/pytest_watch/watcher.py @@ -19,7 +19,8 @@ from watchdog.observers.polling import PollingObserver from .constants import ( - ALL_EXTENSIONS, EXIT_NOTESTSCOLLECTED, EXIT_OK, DEFAULT_EXTENSIONS) + ALL_EXTENSIONS, EXIT_INTERRUPTED, EXIT_NOTESTSCOLLECTED, EXIT_OK, + DEFAULT_EXTENSIONS) from .helpers import ( beep, clear, dequeue_all, is_windows, samepath, send_keyboard_interrupt) @@ -297,7 +298,7 @@ def watch(entries=[], ignore=[], extensions=[], beep_on_failure=True, # Run dependent commands if exit_code in [EXIT_OK, EXIT_NOTESTSCOLLECTED]: run_hook(onpass) - else: + elif exit_code != EXIT_INTERRUPTED: if beep_on_failure: beep() run_hook(onfail)