URL: https://github.com/freeipa/freeipa/pull/1669
Author: Rezney
 Title: #1669: test_caless: adjust try/except to capture all [Errno 2] - ENOENT
Action: opened

PR body:
"""
While testing on RHEL we are getting IOError instead of OSError.
Add also IOError and check for [Errno 2] - ENOENT there.

This is mostly for compatibility reasons however should not cause
any issue as IOError is alias for OSError on Python3.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1669/head:pr1669
git checkout pr1669
From e3a519c979fd76b71505407b368c7b7068d68ca1 Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Mon, 12 Mar 2018 15:06:33 +0100
Subject: [PATCH] test_caless: adjust try/except to capture all [Errno 2] -
 ENOENT

While testing on RHEL we are getting IOError instead of OSError.
Add also IOError and check for [Errno 2] - ENOENT there.

This is mostly for compatibility reasons however should not cause
any issue as IOError is alias for OSError on Python3.
---
 ipatests/test_integration/test_caless.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py
index 9be8c4f413..d3b396baf2 100644
--- a/ipatests/test_integration/test_caless.py
+++ b/ipatests/test_integration/test_caless.py
@@ -24,7 +24,7 @@
 import glob
 import contextlib
 import unittest
-
+import errno
 import pytest
 import six
 
@@ -273,8 +273,10 @@ def prepare_replica(self, _replica_number=0, replica=None, master=None,
                 destination_host.transport.put_file(
                     os.path.join(self.cert_dir, filename),
                     os.path.join(destination_host.config.test_dir, filename))
-            except OSError:
-                pass
+            except (IOError, OSError) as e:
+                if e.errno == errno.ENOENT:
+                    pass
+
         extra_args = []
         if http_pkcs12_exists:
             extra_args.extend(['--http-cert-file', http_pkcs12])
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to