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 2021/03/26 16:51:26 UTC

[qpid-dispatch] branch master updated: DISPATCH-1756 Don't hardcode errnos in test, macOS uses different numerical codes (#1087)

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-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new ee47141  DISPATCH-1756 Don't hardcode errnos in test, macOS uses different numerical codes (#1087)
ee47141 is described below

commit ee47141187f2987f05529563e5c2aef5a889151b
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Fri Mar 26 17:48:43 2021 +0100

    DISPATCH-1756 Don't hardcode errnos in test, macOS uses different numerical codes (#1087)
---
 tests/system_tests_http.py.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/system_tests_http.py.in b/tests/system_tests_http.py.in
index a998ae4..7fb93aa 100644
--- a/tests/system_tests_http.py.in
+++ b/tests/system_tests_http.py.in
@@ -21,6 +21,7 @@ from __future__ import division
 from __future__ import absolute_import
 from __future__ import print_function
 
+import errno
 import os
 import threading
 import ssl
@@ -105,10 +106,9 @@ class RouterTestHttp(TestCase):
             else:
                 self.get(url, use_ca=use_ca)
             return False
-        except Exception as e:
-            if "[Errno 111] Connection refused" in str(e):
-                return True
-            if "[Errno 104] Connection reset by peer" in str(e):
+        except (IOError, OSError) as e:  # TODO(DISPATCH-1539): in Python 3.3+ it is sufficient to catch only OSError
+            expected = (errno.ECONNREFUSED, errno.ECONNRESET)
+            if e.errno in expected or e.reason.errno in expected:
                 return True
             raise e
 

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