aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-10-17 17:21:09 +1300
committerDouglas Bagnall <dbagnall@samba.org>2018-10-18 10:04:02 +0200
commit30e9c00f2d8ba6395deb4fe8734e41b1000f13f0 (patch)
treee855883125c7edf421a43b82d0071c13dd3db7cd
parent204bd0e447b5a83f603eac9dd317bdb026539cbc (diff)
downloadsamba-30e9c00f2d8ba6395deb4fe8734e41b1000f13f0.tar.gz
samba-30e9c00f2d8ba6395deb4fe8734e41b1000f13f0.tar.xz
samba-30e9c00f2d8ba6395deb4fe8734e41b1000f13f0.zip
py3_tests/kcc : test_verify can hit KCCError as well as GraphError
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--python/samba/tests/kcc/__init__.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/python/samba/tests/kcc/__init__.py b/python/samba/tests/kcc/__init__.py
index a8b50709d1b..3ca20845c58 100644
--- a/python/samba/tests/kcc/__init__.py
+++ b/python/samba/tests/kcc/__init__.py
@@ -78,22 +78,13 @@ class KCCTests(samba.tests.TestCase):
my_kcc = kcc.KCC(unix_now, readonly=True, verify=True,
debug=False, dot_file_dir=None)
- #
- # The following seems to raise
- # samba.kcc.graph_utils.GraphError when something
- # goes wrong.
- #
- # Typically failureException is exceptions.AssertionError
- # by default, see pydoc unittest.TestCase
- #
- # As this is flapping under python3, we need to
- # make sure it generates a failure instead of an error.
- #
- # We need to make sure samba.kcc.graph_utils.GraphError
- # will generate a failure from here on.
- #
- self.failureException = samba.kcc.graph_utils.GraphError
-
- my_kcc.run("ldap://%s" % os.environ["SERVER"],
- self.lp, self.creds,
- attempt_live_connections=False)
+ # As this is flapping with errors under python3, we catch
+ # exceptions and turn them into failures..
+ try:
+ my_kcc.run("ldap://%s" % os.environ["SERVER"],
+ self.lp, self.creds,
+ attempt_live_connections=False)
+ except (samba.kcc.graph_utils.GraphError, kcc.KCCError):
+ import traceback
+ traceback.print_exc()
+ self.fail()