dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

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

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