richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
f6faf3
From 172e1f5ec0e37c8aab91a2ae35bd73ea594432cb Mon Sep 17 00:00:00 2001
f6faf3
Message-Id: <172e1f5ec0e37c8aab91a2ae35bd73ea594432cb.1571920849.git.pmatilai@redhat.com>
f6faf3
In-Reply-To: <6b6c4d881dc6fc99f949dac4aaf9a513542f9956.1571920849.git.pmatilai@redhat.com>
f6faf3
References: <6b6c4d881dc6fc99f949dac4aaf9a513542f9956.1571920849.git.pmatilai@redhat.com>
f6faf3
From: Panu Matilainen <pmatilai@redhat.com>
f6faf3
Date: Thu, 4 Oct 2018 13:36:09 +0300
f6faf3
Subject: [PATCH 2/5] Use Python 3 -compatible exception syntax in tests
f6faf3
f6faf3
Makes a few tests pass that failed before, and others now fail
f6faf3
a little bit later...
f6faf3
f6faf3
(cherry picked from commit 511eef19298765e3639bccbe98bc3a50023f45b2)
f6faf3
---
f6faf3
 tests/rpmpython.at | 12 ++++++------
f6faf3
 1 file changed, 6 insertions(+), 6 deletions(-)
f6faf3
f6faf3
diff --git a/tests/rpmpython.at b/tests/rpmpython.at
f6faf3
index 3a7c251f1..1daaf1216 100644
f6faf3
--- a/tests/rpmpython.at
f6faf3
+++ b/tests/rpmpython.at
f6faf3
@@ -96,7 +96,7 @@ for a in ['name', 'bugurl', '__class__', '__foo__', ]:
f6faf3
     try:
f6faf3
         x = getattr(h, a)
f6faf3
         myprint(x)
f6faf3
-    except AttributeError, exc:
f6faf3
+    except AttributeError as exc:
f6faf3
         myprint(exc)
f6faf3
 ],
f6faf3
 [testpkg-5:1.0-1.noarch
f6faf3
@@ -119,7 +119,7 @@ h2['dirindexes'] = [ 0, 0, 1 ]
f6faf3
 for h in [h1, h2]:
f6faf3
     try:
f6faf3
         myprint(','.join(h['filenames']))
f6faf3
-    except rpm.error, exc:
f6faf3
+    except rpm.error as exc:
f6faf3
         myprint(exc)
f6faf3
 ],
f6faf3
 [invalid header data
f6faf3
@@ -164,7 +164,7 @@ rpm.setLogFile(sink)
f6faf3
 try:
f6faf3
     h = ts.hdrFromFdno('${RPMDATA}/RPMS/hello-2.0-1.x86_64-signed.rpm')
f6faf3
     myprint(h['arch'])
f6faf3
-except rpm.error, e:
f6faf3
+except rpm.error as e:
f6faf3
     myprint(e)
f6faf3
 ],
f6faf3
 [public key not available
f6faf3
@@ -183,7 +183,7 @@ ts.setKeyring(keyring)
f6faf3
 try:
f6faf3
     h = ts.hdrFromFdno('${RPMDATA}/RPMS/hello-2.0-1.x86_64-signed.rpm')
f6faf3
     myprint(h['arch'])
f6faf3
-except rpm.error, e:
f6faf3
+except rpm.error as e:
f6faf3
     myprint(e)
f6faf3
 ],
f6faf3
 [x86_64]
f6faf3
@@ -207,7 +207,7 @@ h = rpm.hdr()
f6faf3
 h['name'] = "foo"
f6faf3
 try:
f6faf3
     ts.addInstall(h, 'foo', 'u')
f6faf3
-except rpm.error, err:
f6faf3
+except rpm.error as err:
f6faf3
     myprint(err)
f6faf3
 for e in ts:
f6faf3
     myprint(e.NEVRA())
f6faf3
@@ -228,7 +228,7 @@ h['dirnames'] = ['/opt' '/flopt']
f6faf3
 h['dirindexes'] = [ 1, 2, 3 ]
f6faf3
 try:
f6faf3
     ts.addInstall(h, 'foo', 'u')
f6faf3
-except rpm.error, err:
f6faf3
+except rpm.error as err:
f6faf3
     myprint(err)
f6faf3
 for e in ts:
f6faf3
     myprint(e.NEVRA())
f6faf3
-- 
f6faf3
2.21.0
f6faf3