summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-02-23 14:32:17 +0000
committerDouglas Bagnall <dbagnall@samba.org>2018-02-28 23:01:40 +0100
commit0de23d27d6b01f2501d076cc98f48ee72c48d50a (patch)
tree3593385f843da73b98c14c3e661c3b3b5c1e2271 /python
parent52729d35495db638c84caa8cc6f5ffdf0b670353 (diff)
downloadsamba-0de23d27d6b01f2501d076cc98f48ee72c48d50a.tar.gz
samba python tests: convert 'except X, (tuple)' to 'except X as e'
In addition to converting the except line another line is also added for each except to extract the tuple contents. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/auth_log_pass_change.py6
-rw-r--r--python/samba/tests/dns.py3
-rw-r--r--python/samba/tests/samba_tool/fsmo.py3
-rw-r--r--python/samba/tests/samdb_api.py6
4 files changed, 12 insertions, 6 deletions
diff --git a/python/samba/tests/auth_log_pass_change.py b/python/samba/tests/auth_log_pass_change.py
index 8ed92814960..77758a4430a 100644
--- a/python/samba/tests/auth_log_pass_change.py
+++ b/python/samba/tests/auth_log_pass_change.py
@@ -290,7 +290,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
"userPassword: " + new_password + "\n"
)
self.fail()
- except LdbError, (num, msg):
+ except LdbError as e:
+ (num, msg) = e.args
pass
messages = self.waitForMessages(isLastExpectedMessage)
@@ -320,7 +321,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
"userPassword: " + new_password + "\n"
)
self.fail()
- except LdbError, (num, msg):
+ except LdbError as e1:
+ (num, msg) = e1.args
pass
messages = self.waitForMessages(isLastExpectedMessage)
diff --git a/python/samba/tests/dns.py b/python/samba/tests/dns.py
index 1b5b64da3a4..8aecfe3be59 100644
--- a/python/samba/tests/dns.py
+++ b/python/samba/tests/dns.py
@@ -890,7 +890,8 @@ class TestZones(DNSTest):
super(TestZones, self).tearDown()
try:
self.delete_zone(self.zone)
- except RuntimeError, (num, string):
+ except RuntimeError as e:
+ (num, string) = e.args
if num != werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST:
raise
diff --git a/python/samba/tests/samba_tool/fsmo.py b/python/samba/tests/samba_tool/fsmo.py
index c985830cf6c..7fd0ae2e033 100644
--- a/python/samba/tests/samba_tool/fsmo.py
+++ b/python/samba/tests/samba_tool/fsmo.py
@@ -37,7 +37,8 @@ class FsmoCmdTestCase(SambaToolCmdTest):
scope=ldb.SCOPE_BASE, attrs=["fsmoRoleOwner"])
self.assertTrue("DomainDnsZonesMasterRole owner: " + res[0]["fsmoRoleOwner"][0] in out)
- except ldb.LdbError, (enum, string):
+ except ldb.LdbError as e:
+ (enum, string) = e.args
if enum == ldb.ERR_NO_SUCH_OBJECT:
self.assertTrue("The 'domaindns' role is not present in this domain" in out)
else:
diff --git a/python/samba/tests/samdb_api.py b/python/samba/tests/samdb_api.py
index 81c62665dd4..259952031b5 100644
--- a/python/samba/tests/samdb_api.py
+++ b/python/samba/tests/samdb_api.py
@@ -56,7 +56,8 @@ class SamDBApiTestCase(TestCaseInTempDir):
try:
SamDB(url="tdb://" + existing_name)
self.fail("Exception not thrown ")
- except LdbError as (err, _):
+ except LdbError as e:
+ (err, _) = e.args
self.assertEquals(err, ERR_OPERATIONS_ERROR)
existing = open(existing_name, "r")
@@ -136,7 +137,8 @@ class SamDBApiTestCase(TestCaseInTempDir):
try:
SamDB(url="tdb://" + self.tempdir + "/test.db")
self.fail("Exception not thrown ")
- except LdbError as (err, _):
+ except LdbError as e1:
+ (err, _) = e1.args
self.assertEquals(err, ERR_OPERATIONS_ERROR)
try: