[Pkg-bitcoin-commits] [python-quamash] 56/78: rewrite subprocess terminate test to use high level api

Jonas Smedegaard dr at jones.dk
Tue Dec 19 01:19:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.6.0_dfsg-1
in repository python-quamash.

commit 25904d52e73944d65380d2fa8303cb7bec5b57bf
Author: Mark Thomas West Harviston <mark.harviston at gmail.com>
Date:   Sun Nov 19 17:23:25 2017 -0800

    rewrite subprocess terminate test to use high level api
---
 tests/test_qeventloop.py | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/tests/test_qeventloop.py b/tests/test_qeventloop.py
index b86e8c2..53b775c 100644
--- a/tests/test_qeventloop.py
+++ b/tests/test_qeventloop.py
@@ -166,18 +166,14 @@ def test_can_communicate_subprocess(loop):
 def test_can_terminate_subprocess(loop):
 	"""Verify that a subprocess can be terminated."""
 	# Start a never-ending process
-	transport = loop.run_until_complete(
-		loop.subprocess_exec(
-			_SubprocessProtocol, sys.executable or 'python', '-c', 'import time\nwhile True: time.sleep(1)',
-		),
-	)[0]
-	# Terminate!
-	transport.kill()
-	# Wait for process to die
-	loop.run_forever()
-
-	assert transport.get_returncode() != 0
-
+	@asyncio.coroutine
+	def mycoro():
+		process = yield from asyncio.create_subprocess_exec(
+			sys.executable or 'python', '-c',  'import time\nwhile True: time.sleep(1)')
+		process.terminate()
+		yield from process.wait()
+		assert process.returncode != 0
+	loop.run_until_complete(mycoro())
 
 @pytest.mark.raises(ExceptionTester)
 def test_loop_callback_exceptions_bubble_up(loop):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git



More information about the Pkg-bitcoin-commits mailing list