dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

Blame SOURCES/0003-Fix-couple-of-bytes-vs-strings-issues-in-Python-test.patch

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