From 34bbf47e60bd1d5d5916738e5d8fb0ccc6b80898 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 17 Sep 2001 00:00:00 +0000 Subject: [PATCH] Add io.StringIO subclass for writing gpg process results to a string. * These .write()s need to be forced to unicode for StringIO to handle them correctly. --- test_gnupg.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test_gnupg.py b/test_gnupg.py index 1d73f19..ce9165a 100644 --- a/test_gnupg.py +++ b/test_gnupg.py @@ -7,6 +7,7 @@ Copyright © 2008-2013 Vinay Sajip. All rights reserved. """ import doctest import logging +import io import os.path import os import shutil @@ -89,6 +90,13 @@ def compare_keys(k1, k2): del k2[1] return k1 != k2 +class ResultStringIO(io.StringIO): + def __init__(self): + super(self, io.StringIO).__init__() + + def write(self, data): + super(self, io.StringIO).write(unicode(data)) + class GPGTestCase(unittest.TestCase): def setUp(self): hd = os.path.join(os.getcwd(), 'keys')