summaryrefslogtreecommitdiffhomepage
path: root/test/conftest.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-11-16 20:37:01 +0300
committerMax Romanov <max.romanov@nginx.com>2020-11-16 20:37:01 +0300
commit567f0a7b3049f4532524ac35cb232cbeedb868bf (patch)
tree8a2eb4f43b5750c6e4fa47d7278a0b2e6e9508ce /test/conftest.py
parent6d2b60ff3e6f905b81c6d2fc6595b39250e3a586 (diff)
downloadunit-567f0a7b3049f4532524ac35cb232cbeedb868bf.tar.gz
unit-567f0a7b3049f4532524ac35cb232cbeedb868bf.tar.bz2
Tests: fixing tests interrupt in terminal.
KeyboardInterrupt re-raised.
Diffstat (limited to 'test/conftest.py')
-rw-r--r--test/conftest.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/conftest.py b/test/conftest.py
index 9aaf7640..3edc471d 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -215,7 +215,7 @@ def run(request):
# print unit.log in case of error
- if request.node.rep_call.failed:
+ if hasattr(request.node, 'rep_call') and request.node.rep_call.failed:
_print_log()
# remove unit.log
@@ -284,6 +284,11 @@ def unit_stop():
retcode = p.wait(15)
if retcode:
return 'Child process terminated with code ' + str(retcode)
+
+ except KeyboardInterrupt:
+ p.kill()
+ raise
+
except:
p.kill()
return 'Could not terminate unit'
@@ -403,6 +408,10 @@ def waitforsocket(port):
sock.connect(('127.0.0.1', port))
ret = True
break
+
+ except KeyboardInterrupt:
+ raise
+
except:
sock.close()
time.sleep(0.1)