richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
ed184b
From 6525a9bf1529944741f273cb9fde5619f006a673 Mon Sep 17 00:00:00 2001
ed184b
Message-Id: <6525a9bf1529944741f273cb9fde5619f006a673.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 17:41:19 +0300
ed184b
Subject: [PATCH 3/5] Fix couple of bytes vs strings issues in Python tests
ed184b
ed184b
For the purposes of rpmio testing and importing public key, we're
ed184b
dealing with bytes rather than encoded strings. In the carefree days
ed184b
of Python 2 such details didn't matter, in Python 3 they cause failures.
ed184b
The signed package test still fails after this one but it's due to
ed184b
a more general issue.
ed184b
ed184b
(cherry picked from commit 86f7898dd6a7fa8718c02675f5a7ee04ff987422)
ed184b
---
ed184b
 tests/rpmpython.at | 4 ++--
ed184b
 1 file changed, 2 insertions(+), 2 deletions(-)
ed184b
ed184b
diff --git a/tests/rpmpython.at b/tests/rpmpython.at
ed184b
index 1daaf1216..ae020ae95 100644
ed184b
--- a/tests/rpmpython.at
ed184b
+++ b/tests/rpmpython.at
ed184b
@@ -33,7 +33,7 @@ prexp(mname)
ed184b
 [])
ed184b
 
ed184b
 RPMPY_TEST([basic rpmio],[
ed184b
-msg = 'Killroy was here\n'
ed184b
+msg = b'Killroy was here\n'
ed184b
 data = msg * 10
ed184b
 # TODO: test other compression types too if built in
ed184b
 for iot in [ 'fpio', 'fdio', 'ufdio', 'gzdio' ]:
ed184b
@@ -173,7 +173,7 @@ except rpm.error as e:
ed184b
 
ed184b
 RPMPY_TEST([reading a signed package file 2],[
ed184b
 
ed184b
-keydata = open('${RPMDATA}/keys/rpm.org-rsa-2048-test.pub').read()
ed184b
+keydata = open('${RPMDATA}/keys/rpm.org-rsa-2048-test.pub', 'rb').read()
ed184b
 pubkey = rpm.pubkey(keydata)
ed184b
 keyring = rpm.keyring()
ed184b
 keyring.addKey(pubkey)
ed184b
-- 
ed184b
2.21.0
ed184b