You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2020/07/02 12:09:48 UTC

[qpid-proton] branch master updated: PROTON-2220 fix cleanup in test_broker @contextmanager (#264)

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b2e751  PROTON-2220 fix cleanup in test_broker @contextmanager (#264)
3b2e751 is described below

commit 3b2e75156af7b857f2b0dfb72a2696ebd2274b16
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Thu Jul 2 14:05:29 2020 +0200

    PROTON-2220 fix cleanup in test_broker @contextmanager (#264)
    
    Python context managers propagate thrown exceptions out of their `yield` statement.
    If the test broker is to be always stopped, a finally block is necessary.
---
 .../integration/test_PROTON_1800_syncrequestresponse_fd_leak.py    | 7 ++++---
 .../integration/test_PROTON_2121_blocking_connection_fd_leak.py    | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/python/tests/integration/test_PROTON_1800_syncrequestresponse_fd_leak.py b/python/tests/integration/test_PROTON_1800_syncrequestresponse_fd_leak.py
index 62134c2..614ed7e 100644
--- a/python/tests/integration/test_PROTON_1800_syncrequestresponse_fd_leak.py
+++ b/python/tests/integration/test_PROTON_1800_syncrequestresponse_fd_leak.py
@@ -114,9 +114,10 @@ def test_broker():
     container = proton.reactor.Container(broker)
     threading.Thread(target=container.run).start()
 
-    yield broker
-
-    container.stop()
+    try:
+        yield broker
+    finally:
+        container.stop()
 
 
 PROC_SELF_FD_EXISTS = os.path.exists("/proc/self/fd"), "Skipped: Directory /proc/self/fd does not exist"
diff --git a/python/tests/integration/test_PROTON_2121_blocking_connection_fd_leak.py b/python/tests/integration/test_PROTON_2121_blocking_connection_fd_leak.py
index 97ed624..58e121c 100644
--- a/python/tests/integration/test_PROTON_2121_blocking_connection_fd_leak.py
+++ b/python/tests/integration/test_PROTON_2121_blocking_connection_fd_leak.py
@@ -101,9 +101,10 @@ def test_broker():
     container = proton.reactor.Container(broker)
     threading.Thread(target=container.run).start()
 
-    yield broker
-
-    container.stop()
+    try:
+        yield broker
+    finally:
+        container.stop()
 
 
 PROC_SELF_FD_EXISTS = os.path.exists("/proc/self/fd"), "Skipped: Directory /proc/self/fd does not exist"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org