s4/dsdb/pytests: Py3 compatitble except clauses
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 11 Oct 2018 03:52:14 +0000 (16:52 +1300)
committerNoel Power <npower@samba.org>
Thu, 25 Oct 2018 19:45:58 +0000 (21:45 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
source4/dsdb/tests/python/ad_dc_medley_performance.py
source4/dsdb/tests/python/passwords.py

index f484cae9e0898ef1af628399a5ea8a419b3660cf..1101ca0e16029445ffefe07f9f6930af5c3182a7 100644 (file)
@@ -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
 
index 0f73cf31928d78104c95a974da55dbd022b53ce2..b68637242be854c1e804a7b458bf061be8692402 100755 (executable)
@@ -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()