chantra / rpms / rpm

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