dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

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

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