From d56f9237d7205cbc2db24fa5fbdc27000454291f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Sep 2016 09:36:57 -0400 Subject: Tests: Teach Server test to wait for server exit We expect the server to exit when its communication pipes are closed. Close them and wait for the server to exit. If supported by the current version of python, kill the server if it does not exit after a few seconds. --- Tests/Server/server-test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py index 72f82ba..14767f4 100644 --- a/Tests/Server/server-test.py +++ b/Tests/Server/server-test.py @@ -102,4 +102,18 @@ for obj in testData: print("Completed") +# Tell the server to exit. +proc.stdin.close() +proc.stdout.close() + +# Wait for the server to exit. +# If this version of python supports it, terminate the server after a timeout. +try: + proc.wait(timeout=5) +except TypeError: + proc.wait() +except: + proc.terminate() + raise + sys.exit(0) -- cgit v0.12