From: Douglas Bagnall Date: Thu, 11 Oct 2018 03:52:14 +0000 (+1300) Subject: s4/dsdb/pytests: Py3 compatitble except clauses X-Git-Tag: tdb-1.3.17~1158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41844d13fe9c5749b04dc5fede0b9f4fcc0d8df2;p=thirdparty%2Fsamba.git s4/dsdb/pytests: Py3 compatitble except clauses Signed-off-by: Douglas Bagnall Reviewed-by: Noel Power --- diff --git a/source4/dsdb/tests/python/ad_dc_medley_performance.py b/source4/dsdb/tests/python/ad_dc_medley_performance.py index f484cae9e08..1101ca0e160 100644 --- a/source4/dsdb/tests/python/ad_dc_medley_performance.py +++ b/source4/dsdb/tests/python/ad_dc_medley_performance.py @@ -234,7 +234,8 @@ class UserTests(samba.tests.TestCase): self.ldb.search(pattern % i, scope=SCOPE_BASE, attrs=['cn']) - except LdbError as (num, msg): + except LdbError as e: + (num, msg) = e if num != ERR_NO_SUCH_OBJECT: raise diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index 0f73cf31928..b68637242be 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -1088,7 +1088,8 @@ delete: userPassword add: userPassword userPassword: thatsAcomplPASS1 """) - except LdbError, (num, msg): + except LdbError as e: + (num, msg) = e self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) else: self.fail() @@ -1104,7 +1105,8 @@ delete: clearTextPassword add: clearTextPassword clearTextPassword: thatsAcomplPASS2 """) - except LdbError, (num, msg): + except LdbError as e: + (num, msg) = e self.assertTrue(num == ERR_CONSTRAINT_VIOLATION or num == ERR_NO_SUCH_ATTRIBUTE) # for Windows else: @@ -1121,7 +1123,8 @@ delete: unicodePwd add: unicodePwd unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).decode('utf8') + """ """) - except LdbError, (num, msg): + except LdbError as e: + (num, msg) = e self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) else: self.fail()