[Pkg-bitcoin-commits] [python-quamash] 60/78: ensure is_running() returns false immediately after stopping

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 45a497afb2e09809d320a4576d60bdbb71a8dcf3
Author: Mark Thomas West Harviston <mark.harviston at gmail.com>
Date:   Sun Nov 19 19:48:45 2017 -0800

    ensure is_running() returns false immediately after stopping
---
 quamash/__init__.py      |  1 +
 tests/test_qeventloop.py | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/quamash/__init__.py b/quamash/__init__.py
index bc2bf5f..f9ed056 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -302,6 +302,7 @@ class QEventLoop(_baseclass):
 			return
 
 		self._logger.debug('Stopping event loop...')
+		self.__is_running = False
 		self.__app.exit()
 		self._logger.debug('Stopped event loop')
 
diff --git a/tests/test_qeventloop.py b/tests/test_qeventloop.py
index 1417aaa..7b50540 100644
--- a/tests/test_qeventloop.py
+++ b/tests/test_qeventloop.py
@@ -727,3 +727,15 @@ def test_exception_handler_simple(loop):
 	loop.call_later(0.1, loop.stop)
 	loop.run_forever()
 	assert handler_called
+
+
+def test_not_running_immediately_after_stopped(loop):
+	@asyncio.coroutine
+	def mycoro():
+		assert loop.is_running()
+		yield from asyncio.sleep(0)
+		loop.stop()
+		assert not loop.is_running()
+	assert not loop.is_running()
+	loop.run_until_complete(mycoro())
+	assert not loop.is_running()

-- 
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