michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

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

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