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.feature/documentation-builds-dirhtml
parent
629d13c27c
commit
34bbf47e60
|
@ -7,6 +7,7 @@ Copyright © 2008-2013 Vinay Sajip. All rights reserved.
|
||||||
"""
|
"""
|
||||||
import doctest
|
import doctest
|
||||||
import logging
|
import logging
|
||||||
|
import io
|
||||||
import os.path
|
import os.path
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -89,6 +90,13 @@ def compare_keys(k1, k2):
|
||||||
del k2[1]
|
del k2[1]
|
||||||
return k1 != k2
|
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):
|
class GPGTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
hd = os.path.join(os.getcwd(), 'keys')
|
hd = os.path.join(os.getcwd(), 'keys')
|
||||||
|
|
Loading…
Reference in New Issue