Blame SOURCES/0002-Use-Python-3-compatible-exception-syntax-in-tests.patch

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