summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-02-14 10:31:33 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-02-15 00:18:30 +0100
commit20e38fbd457a35e90662a284bead44b05393f54b (patch)
tree10dac0c6535573efae19e18e095b09bc374295a0
parent28134d002b632a7fcd52906604412889fc973ef5 (diff)
downloadsamba-20e38fbd457a35e90662a284bead44b05393f54b.tar.gz
dsdb python tests: convert 'except X, e' to 'except X as e'
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-xsource4/dsdb/tests/python/dirsync.py14
-rw-r--r--source4/dsdb/tests/python/linked_attributes.py2
-rwxr-xr-xsource4/dsdb/tests/python/rodc.py4
-rw-r--r--source4/dsdb/tests/python/rodc_rwdc.py10
-rwxr-xr-xsource4/dsdb/tests/python/sites.py2
-rw-r--r--source4/dsdb/tests/python/sort.py2
-rw-r--r--source4/dsdb/tests/python/vlv.py4
7 files changed, 19 insertions, 19 deletions
diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py
index e302c42d8bb..2da776a5766 100755
--- a/source4/dsdb/tests/python/dirsync.py
+++ b/source4/dsdb/tests/python/dirsync.py
@@ -152,7 +152,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_simple.search(self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:0:1"])
- except LdbError,l:
+ except LdbError as l:
self.assertTrue(str(l).find("LDAP_INSUFFICIENT_ACCESS_RIGHTS") != -1)
def test_parentGUID_referrals(self):
@@ -177,7 +177,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_simple.search(self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:0:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_INSUFFICIENT_ACCESS_RIGHTS") != -1)
@@ -185,7 +185,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_simple.search("CN=Users,%s" % self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:0:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_INSUFFICIENT_ACCESS_RIGHTS") != -1)
@@ -193,7 +193,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_simple.search("CN=Users,%s" % self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:1:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_UNWILLING_TO_PERFORM") != -1)
@@ -201,7 +201,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_dirsync.search("CN=Users,%s" % self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:0:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_INSUFFICIENT_ACCESS_RIGHTS") != -1)
@@ -209,7 +209,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_admin.search("CN=Users,%s" % self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:0:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_INSUFFICIENT_ACCESS_RIGHTS") != -1)
@@ -217,7 +217,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
self.ldb_admin.search("CN=Users,%s" % self.base_dn,
expression="samaccountname=*",
controls=["dirsync:1:1:1"])
- except LdbError,l:
+ except LdbError as l:
print l
self.assertTrue(str(l).find("LDAP_UNWILLING_TO_PERFORM") != -1)
diff --git a/source4/dsdb/tests/python/linked_attributes.py b/source4/dsdb/tests/python/linked_attributes.py
index 09f83f8ca4f..255b5113bcf 100644
--- a/source4/dsdb/tests/python/linked_attributes.py
+++ b/source4/dsdb/tests/python/linked_attributes.py
@@ -64,7 +64,7 @@ class LATests(samba.tests.TestCase):
if opts.delete_in_setup:
try:
self.samdb.delete(self.ou, ['tree_delete:1'])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
print "tried deleting %s, got error %s" % (self.ou, e)
self.samdb.add({'objectclass': 'organizationalUnit',
'dn': self.ou})
diff --git a/source4/dsdb/tests/python/rodc.py b/source4/dsdb/tests/python/rodc.py
index 665ae15ffae..fff8a61e8a9 100755
--- a/source4/dsdb/tests/python/rodc.py
+++ b/source4/dsdb/tests/python/rodc.py
@@ -83,7 +83,7 @@ class RodcTests(samba.tests.TestCase):
session_info=system_session(LP), lp=LP)
tmpdb.add(o)
tmpdb.delete(o['dn'])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.fail("couldn't modify referred location %s" %
address)
@@ -117,7 +117,7 @@ class RodcTests(samba.tests.TestCase):
tmpdb = SamDB(address, credentials=CREDS,
session_info=system_session(LP), lp=LP)
tmpdb.modify(msg)
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.fail("couldn't modify referred location %s" %
address)
diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py
index 8c6dd4cf834..ae33dfaac11 100644
--- a/source4/dsdb/tests/python/rodc_rwdc.py
+++ b/source4/dsdb/tests/python/rodc_rwdc.py
@@ -818,7 +818,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
attrs=['dn'],
controls=controls)
self.assertEqual(len(res), 0)
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
if e.args[0] != ldb.ERR_NO_SUCH_OBJECT:
raise
@@ -840,7 +840,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
attrs=['dn'],
controls=controls)
self.assertEqual(len(res), 1)
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.assertNotEqual(e.args[0], ldb.ERR_NO_SUCH_OBJECT,
"replication seems to have failed")
@@ -916,7 +916,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
attrs=[attr])
results = [x[attr][0] for x in res]
self.assertEqual(results, [value])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.assertNotEqual(e.args[0], ldb.ERR_NO_SUCH_OBJECT,
"replication seems to have failed")
@@ -961,7 +961,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
attrs=[attr])
results = [x[attr][0] for x in res]
self.assertEqual(results, [value])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.assertNotEqual(e.args[0], ldb.ERR_NO_SUCH_OBJECT,
"replication seems to have failed")
@@ -973,7 +973,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
attrs=[attr])
if len(res) > 0:
self.fail("Failed to delete %s" % (dn))
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
self.assertEqual(e.args[0], ldb.ERR_NO_SUCH_OBJECT,
"Failed to delete %s" % (dn))
diff --git a/source4/dsdb/tests/python/sites.py b/source4/dsdb/tests/python/sites.py
index a894da327a9..a24f9b576d9 100755
--- a/source4/dsdb/tests/python/sites.py
+++ b/source4/dsdb/tests/python/sites.py
@@ -481,7 +481,7 @@ class SimpleSubnetTests(SitesBaseTests):
for cidr in cidrs:
try:
subnets.create_subnet(self.ldb, basedn, cidr, self.sitename)
- except subnets.SubnetInvalid, e:
+ except subnets.SubnetInvalid as e:
print e
failures.append(cidr)
continue
diff --git a/source4/dsdb/tests/python/sort.py b/source4/dsdb/tests/python/sort.py
index ec357c7fffe..089e4b520cc 100644
--- a/source4/dsdb/tests/python/sort.py
+++ b/source4/dsdb/tests/python/sort.py
@@ -133,7 +133,7 @@ class BaseSortTests(samba.tests.TestCase):
if False:
try:
self.ldb.delete(self.ou, ['tree_delete:1'])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
print "tried deleting %s, got error %s" % (self.ou, e)
self.ldb.add({
diff --git a/source4/dsdb/tests/python/vlv.py b/source4/dsdb/tests/python/vlv.py
index 9fe453d7b80..d62d01db829 100644
--- a/source4/dsdb/tests/python/vlv.py
+++ b/source4/dsdb/tests/python/vlv.py
@@ -154,7 +154,7 @@ class VLVTests(samba.tests.TestCase):
if opts.delete_in_setup:
try:
self.ldb.delete(self.ou, ['tree_delete:1'])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
print "tried deleting %s, got error %s" % (self.ou, e)
self.ldb.add({
"dn": self.ou,
@@ -697,7 +697,7 @@ class VLVTests(samba.tests.TestCase):
attrs=[attr],
controls=[sort_control,
vlv_search])
- except ldb.LdbError, e:
+ except ldb.LdbError as e:
if offset != 0:
raise
print ("offset %d denominator %d raised error "